-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Move tooltips messages out of html #79742
Move tooltips messages out of html #79742
Conversation
Some changes occurred in HTML/CSS/JS. A change occurred in the Ayu theme. cc @Cldfire Some changes occurred in HTML/CSS themes. |
d484660
to
9b62936
Compare
I haven't checked that it works properly, but the approach seems sane to me. One thing I might do is change |
No idea either. Renaming to |
From discord (for explanations about @Nemo157's suggestion):
|
Ok let's go! @bors: r=Nemo157 |
📌 Commit 152d4e7 has been approved by |
…es-out-of-html, r=Nemo157 Move tooltips messages out of html First thing first: nothing in the output has changed. You still have the "i" on the left of code blocks examples when they have `ignore`, `compile_fail`, `should_panic` and `edition`. The behavior also remains the same: when you hover the "i", you have the corresponding message showing up. So now, why this PR then? I realized recently that we were actually generating those messages into the HTML every time whereas all messages are the same (except for the edition ones, I'll come back to it later). So instead of generating more content, I simply moved it inside the CSS thanks to pseudo elements (`::before` and `::after`). The message is now inside `::after` and we use the `::before` to have the small triangle on the left of the message. So now, we have less HTML generated which is seems pretty nice. So now, back to the `edition` change: the message is globally the same, but the "edition" itself can be different (2015 or 2018 currently, I expect 2021 to arrive not too far in the future). So the only difference for it is that I added a new attribute on the tooltip called `edition` which contains this information. Then, the `::after` uses it inside its `content` (you can get the content of an element's attribute by using `attr` and concat different strings by simply having them after the other). Don't hesitate if a part of my explanations isn't clear. r? `@jyn514`
…es-out-of-html, r=Nemo157 Move tooltips messages out of html First thing first: nothing in the output has changed. You still have the "i" on the left of code blocks examples when they have `ignore`, `compile_fail`, `should_panic` and `edition`. The behavior also remains the same: when you hover the "i", you have the corresponding message showing up. So now, why this PR then? I realized recently that we were actually generating those messages into the HTML every time whereas all messages are the same (except for the edition ones, I'll come back to it later). So instead of generating more content, I simply moved it inside the CSS thanks to pseudo elements (`::before` and `::after`). The message is now inside `::after` and we use the `::before` to have the small triangle on the left of the message. So now, we have less HTML generated which is seems pretty nice. So now, back to the `edition` change: the message is globally the same, but the "edition" itself can be different (2015 or 2018 currently, I expect 2021 to arrive not too far in the future). So the only difference for it is that I added a new attribute on the tooltip called `edition` which contains this information. Then, the `::after` uses it inside its `content` (you can get the content of an element's attribute by using `attr` and concat different strings by simply having them after the other). Don't hesitate if a part of my explanations isn't clear. r? ``@jyn514``
☀️ Test successful - checks-actions |
First thing first: nothing in the output has changed. You still have the "i" on the left of code blocks examples when they have
ignore
,compile_fail
,should_panic
andedition
. The behavior also remains the same: when you hover the "i", you have the corresponding message showing up.So now, why this PR then? I realized recently that we were actually generating those messages into the HTML every time whereas all messages are the same (except for the edition ones, I'll come back to it later). So instead of generating more content, I simply moved it inside the CSS thanks to pseudo elements (
::before
and::after
). The message is now inside::after
and we use the::before
to have the small triangle on the left of the message. So now, we have less HTML generated which is seems pretty nice.So now, back to the
edition
change: the message is globally the same, but the "edition" itself can be different (2015 or 2018 currently, I expect 2021 to arrive not too far in the future). So the only difference for it is that I added a new attribute on the tooltip callededition
which contains this information. Then, the::after
uses it inside itscontent
(you can get the content of an element's attribute by usingattr
and concat different strings by simply having them after the other).Don't hesitate if a part of my explanations isn't clear.
r? @jyn514