Skip to content

Use more jQuery to avoid displaying Expand Description more often. #17035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2014

Conversation

huonw
Copy link
Member

@huonw huonw commented Sep 6, 2014

Sometimes (e.g. on Rust CI) the "expand description" text of the
collapse toggle was displayed by default, when a page is first
loaded (even though the description is expanded), because some
Content-Security-Policy settings disable inline CSS.

Setting it the style with the .css method allows the output to be used
in more places.

@huonw
Copy link
Member Author

huonw commented Sep 6, 2014

e.g. http://www.rust-ci.org/huonw/slow_primes/doc/slow_primes/ has the Expand description text lying on top of the main description.

I can't actually reproduce the issue locally, as it only seems to crop up on Rust CI, but manually inserting this new JS into the page fixes the issue (and manually inserting the old JS in the same manner fails the same as it used to).

@lilyball
Copy link
Contributor

lilyball commented Sep 6, 2014

This isn't a jQuery issue. The issue is the Content-Security-Policy being returned by rust-ci.org:

Content-Security-Policy=default-src 'none'; script-src 'unsafe-inline' 'self'; font-src http://themes.googleusercontent.com 'self'; style-src http://fonts.googleapis.com 'self';

Specifically, it doesn't include 'unsafe-inline' in the style-src list, so inline style attributes/tags are ignored.

@huonw
Copy link
Member Author

huonw commented Sep 6, 2014

Oh I see. In any case, this patch does fix it, so I'll edit the commit message.

@lilyball
Copy link
Contributor

lilyball commented Sep 6, 2014

Which is to say, we should probably tell rust-ci that they should add 'unsafe-inline' to the style-src CSP.

Sometimes (e.g. on Rust CI) the "expand description" text of the
collapse toggle was displayed by default, when a page is first
loaded (even though the description is expanded), because some
Content-Security-Policy settings disable inline CSS.

Setting it the style with the `.css` method allows the output to be used
in more places.
@huonw huonw changed the title Use more jQuery to avoid displaying Expand Description in some Use more jQuery to avoid displaying Expand Description more often. Sep 6, 2014
@lilyball
Copy link
Contributor

lilyball commented Sep 6, 2014

I just emailed Hans Jørgen Hoel about the CSP issue.

bors added a commit that referenced this pull request Sep 7, 2014
Sometimes (e.g. on Rust CI) the "expand description" text of the
collapse toggle was displayed by default, when a page is first
loaded (even though the description is expanded), because some
Content-Security-Policy settings disable inline CSS.

Setting it the style with the `.css` method allows the output to be used
in more places.
@bors bors closed this Sep 7, 2014
@bors bors merged commit 9151874 into rust-lang:master Sep 7, 2014
@huonw huonw deleted the moar-jquery branch September 9, 2014 04:20

$(".method").each(function() {
if ($(this).next().is(".docblock")) {
$(this).children().first().after(toggle);
$(this).children().first().after(toggle[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huonw I think this broke adding the toggles at all :(

See: http://doc.rust-lang.org/std/vec/struct.Vec.html#

CC #17125

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, nice catch.

lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 20, 2024
Run Windows tests on PRs too

Previously PRs would only do a build on Windows, which confusingly meant that PRs got a green tick for Windows despite not testing them.

See discussion in rust-lang#17019.
lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 20, 2024
Run Windows tests on PRs too

Previously PRs would only do a build on Windows, which confusingly meant that PRs got a green tick for Windows despite not testing them.

See discussion in rust-lang#17019.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants