Skip to content

Clean up toggle logic in rustdoc #83332

Description

@Manishearth

I was working on #82114 and discovered that the toggle logic is written scattered all throughout main.js. This seems suboptimal; I'd rather not be generating HTML in main.js. A lot of the toggle logic does things like check the classes of nearby items, etc, which seems super brittle.

I propose we move the toggle logic to Rust code instead; writing a wrapToggle() method that wraps some HTML in a toggle.

Thoughts? @rust-lang/rustdoc

Might be worth creating a meta issue for reducing the size of main.js in general. We seem to do a fair amount of additional codegen there, not just for toggles.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-discussionCategory: Discussion or questions that doesn't represent real issues.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions