Skip to content
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

Character between U+0001 ~ U+001F in string should be escaped when serialized #15947

Closed
upsuper opened this issue Mar 15, 2017 · 5 comments
Closed

Comments

@upsuper
Copy link
Member

@upsuper upsuper commented Mar 15, 2017

See the algorithm of https://drafts.csswg.org/cssom/#serialize-a-string

A simple test code:

<!DOCTYPE HTML>
<p style="background-image: url(\f good)"></p>
<script>
let $p = document.querySelector('p');
alert($p.style.backgroundImage);
</script>

In this case, the serialized output should be url("\f good") rather than a string with unprintable char.

This is actually an issue in rust-cssparser. The corresponding code is https://github.com/servo/rust-cssparser/blob/0caaba170616cba326c4311967354110e4c79c8f/src/serializer.rs#L249-L267

This should be an easy one to fix. cc @SimonSapin

@highfive
Copy link

@highfive highfive commented Mar 15, 2017

Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the #servo channel in IRC.

If you intend to work on this issue, then add @highfive: assign me to your comment, and I'll assign this to you. 😄

@ak1t0
Copy link
Contributor

@ak1t0 ak1t0 commented Mar 15, 2017

I would like to work on this issue.
@highfive: assign me

@highfive
Copy link

@highfive highfive commented Mar 15, 2017

Hey @ak1t0! Thanks for your interest in working on this issue. It's now assigned to you!

@highfive highfive added the C-assigned label Mar 15, 2017
@upsuper
Copy link
Member Author

@upsuper upsuper commented Mar 16, 2017

Note that spec also says NULL character should be serialized to U+FFFD escaped as code point. But that doesn't match what Gecko and Blink do. Both browsers serialize NULL to U+FFFD itself, and we probably should do so here as well.

I've raised an issue to CSSWG in w3c/csswg-drafts#1105.

@upsuper
Copy link
Member Author

@upsuper upsuper commented Mar 16, 2017

FWIW the spec text has been fixed in the expected way.

bors-servo added a commit to servo/rust-cssparser that referenced this issue Mar 21, 2017
Character between U+0001 ~ U+001F in string should be escaped when serialized

Fixes [servo/servo#15947](servo/servo#15947)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/129)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.