W3C home > Mailing lists > Public > public-css-archive@w3.org > May 2017

[csswg-drafts] [css-counter-style] CSSCounterStyleRule::name unnecessarily uses CSS syntax

From: Simon Sapin via GitHub <sysbot+gh@w3.org>
Date: Thu, 04 May 2017 17:16:26 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-226349991-1493918184-sysbot+gh@w3.org>
SimonSapin has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-counter-style] CSSCounterStyleRule::name unnecessarily uses CSS syntax ==
https://drafts.csswg.org/css-counter-styles/#dom-csscounterstylerule-name
> The name attribute on getting must return a CSSOMString object that contains the serialization of the `<counter-style-name>` defined for the associated rule.
>
> On setting the name attribute, run the following steps:
> 
> 1. Parse a component value from the value.
> 2 . If the returned value is an <custom-ident>, […]

Using CSS parsing and seralization here seems unecessary. Within a stylesheet, CSS tokenization rules dictate where an identifier token starts and end, and backslash-escaping can be used to insert arbitrary characters without ending an identifier. But in this API no delimiting is needed, a string already has a clear start and end.

Compare with `CSSKeyframesRule::name`, which is simply “the name of the keyframes”:

https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-name

Test case that shows the difference in Firefox:

```html
data:text/html,<style>@counter-style \@ { symbols: a }@keyframes \@ {}</style><script>document.write(document.styleSheets[0].cssRules[0].name + " " + document.styleSheets[0].cssRules[1].name)</script>
```

@upsuper Do you think it would be web-compatible to change `CSSCounterStyleRule::name` to behave like `CSSKeyframesRule::name`?

CC @tabatkins 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1325 using your GitHub account
Received on Thursday, 4 May 2017 17:16:32 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 10:12:53 UTC