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

[css-typed-om] StylePropertyMap order #700

Closed
annevk opened this issue Feb 21, 2018 · 6 comments
Closed

[css-typed-om] StylePropertyMap order #700

annevk opened this issue Feb 21, 2018 · 6 comments

Comments

@annevk
Copy link
Member

annevk commented Feb 21, 2018

Custom properties, sorted in increasing code-point order.

This seems potentially problematic given JavaScript strings. Do you have tests ensuring this is actually what's being used by implementations and they don't sneakily use code units?

@darrnshn
Copy link
Collaborator

I currently have some tests for the ordering, but it sounds like there are some subtle corner cases with code-point vs code-units?

@tabatkins
Copy link
Member

Comparing by code point is already done elsewhere in CSS; sorting should be fine too. You're right that testing for that detail would be nice.

@darrnshn "code units" are JS "characters", basically - the UTF-16 two-byte chunks. So something from the astral planes is two units wide. Shouldn't be hard to put together a test that sorts oppositely depending on whether you're using code points or code units. I'll look into it.

@tabatkins
Copy link
Member

Here we go, a custom property named --豈 (U+f900) should sort before one named --💩 (U+1f4a9), but as code units the first one is [0x2d, 0x2d, 0xf900], while the second is [0x2d, 0x2d, 0xd83d, 0xdca9], so they'll sort the other way around.

@darrnshn
Copy link
Collaborator

Cool, thanks for the example. I'll write a test for this.

@darrnshn
Copy link
Collaborator

Hmm sorting (non-custom) CSS properties by code point puts -prefixed properties before CSS properties, which appears to be different to getComputedStyle. Is that intended?

@tabatkins
Copy link
Member

Ah, didn't think about single-dash prefixed things. Let's amend the spec to put them between normal and double-dash.

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

No branches or pull requests

3 participants