-
Notifications
You must be signed in to change notification settings - Fork 756
[cssom] Specify serialization of CSSMediaRule and CSSFontFaceRule #728
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
Conversation
cssom/Overview.bs
Outdated
| <li>The string "<code>@media</code>" followed by a single SPACE (U+0020).</li> | ||
| <li>The result of performing <a>serialize a media query list<a> on rule's media query list.</li> | ||
| <li>A single SPACE (U+0020), followed by the string "{", i.e., LEFT CURLY BRACKET (U+007B), followed by a single SPACE (U+0020).</li> | ||
| <li>The result of performing <a>serialize a CSS rule</a> on the each rule in rule's CSSRules list.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/on the/on
There should be spaces between each rule I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, added this too thanks.
6356f8b to
24e026f
Compare
zcorpan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This is a great start.
Please also add yourself to the spec's Acknowledgments section.
cssom/Overview.bs
Outdated
| <ol> | ||
| <li>The string "<code>@font-face {</code>" followed by a single SPACE (U+0020).</li> | ||
| <li>The string "<code>font-family:</code>" followed by a single SPACE (U+0020).</li> | ||
| <li>The result of performing <a>serialize a URL</a> on the rule’s font family name.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serialize a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, fixed this as well.
| <li>The string "<code>;</code>", i.e., SEMICOLON (U+003B).</li> | ||
| </ol> | ||
| </li> | ||
| <li>A single SPACE (U+0020), followed by the string "}", i.e., RIGHT CURLY BRACKET (U+007D).</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the other descriptors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They weren't implemented in servo yet(where I implement this serialization steps) and I forgot these. I added these too, thanks.
cssom/Overview.bs
Outdated
| <ol> | ||
| <li>The string "<code>@media</code>" followed by a single SPACE (U+0020).</li> | ||
| <li>The result of performing <a>serialize a media query list<a> on rule's media query list.</li> | ||
| <li>A single SPACE (U+0020), followed by the string "{", i.e., LEFT CURLY BRACKET (U+007B), followed by a single SPACE (U+0020).</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems browsers use a newline and then indent the child rules by two spaces...
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4682
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, fixed this thanks.
cssom/Overview.bs
Outdated
| <dd> | ||
| The result of concatenating the following: | ||
| <ol> | ||
| <li>The string "<code>@font-face {</code>" followed by a single SPACE (U+0020).</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches Chromium and WebKit but Gecko and Edge use a newline. Gecko and Edge disagree on indentation though... So I guess this is OK.
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4683
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not having a newline also matches the CSSStyleRule serialization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed.
24e026f to
000b1cf
Compare
cssom/Overview.bs
Outdated
| <li>The string "<code>;</code>", i.e., SEMICOLON (U+003B).</li> | ||
| </ol> | ||
| </li> | ||
| <li>If rule's associated <code>unicode-range</code> descriptor is present, a single SPACE (U+0020), followed by the string "<code>unicode-range:</code>", followed by a single SPACE (U+0020), followed by the result of performing serialize a <unicode-rule>, followed by the string "<code>;</code>", i.e., SEMICOLON (U+003B).</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote them as the result of performing serialize a <unicode-rule> because they aren't in exist in current spec. Should I make something different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tabatkins do you have advice on how to define serialization of <urange>?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have one yet, no, but I can write something up. I'd have to do some testing.
|
Any updates? |
|
Sorry for the delay here. I feel that we should probably merge this more or less as-is and file follow-up issues for remaining bits. |
This PR adds serialization steps of CSSMediaRule and CSSFontFaceRule. I reverse-engineered the grammars and came up with these steps.
Serialization of these rules are also implemented with this approach in servo: servo/servo#14238
cc @Manishearth