This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27422 - Remove CSSCharsetRule?
Summary: Remove CSSCharsetRule?
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-24 23:26 UTC by Philip Jägenstedt
Modified: 2015-04-14 11:49 UTC (History)
0 users

See Also:


Attachments

Description Philip Jägenstedt 2014-11-24 23:26:01 UTC
http://dev.w3.org/csswg/cssom/#csscharsetrule

Need a decision to converge on, and the counter makes it seem likely safe to remove:
https://www.chromestatus.com/metrics/feature/timeline/popularity/426
Comment 1 Simon Pieters 2014-11-25 09:08:07 UTC
The use counter counts usage of CSSCharsetRule#encoding but compat problems could manifest without using that attribute, e.g. by assuming a certain index for a later rule in cssRules.

I recommend removing it in one of the browsers. If it sticks I'll remove it from the spec.
Comment 2 Philip Jägenstedt 2014-11-25 23:02:12 UTC
You you write a sentence or two why you want to get rid of CSSCharsetRule from the spec, for reference in an Intent to Remove? If you could mark it as at risk or something in the spec that would be nice too.
Comment 3 Simon Pieters 2014-11-25 23:50:18 UTC
http://dev.w3.org/csswg/css-syntax/#charset-rule explains a bit why it doesn't make sense to have it in the object model.

Also see http://www.w3.org/mid/op.wxt85uaqidj3kv@simons-macbook-pro.local

* @charset is a syntax construct that should not be part of the object model, much like the BOM and comments are not part of the object model.
* When parsing a stylesheet, the first few bytes are scanned for a specific byte pattern to select an encoding. When the actual CSS parser comes to the @charset rule, it is parsed with normal @-rule syntax rules, which is laxer than the scanner. Thus the object model can be claiming an encoding that was not actually picked up by the @charset scanner.
* CSSCharsetRule can be modified but that does not change the encoding of the stylesheet.
* CSSCharsetRule complicates other parts of CSSOM e.g. insertRule, removeRule, CSSNamespaceRule.

I've marked it as being considered for removal in the spec:
https://dvcs.w3.org/hg/csswg/rev/86a5f6f5df18
Comment 4 Philip Jägenstedt 2014-11-26 08:49:02 UTC
Thanks, I'll try to get it removed from Blink and let you know how it goes!
Comment 5 Philip Jägenstedt 2015-01-10 00:45:08 UTC
It's been removed in Blink, but hasn't reached the stable channel yet:
https://code.google.com/p/chromium/issues/detail?id=438147
Comment 6 Philip Jägenstedt 2015-03-28 02:45:32 UTC
The removal reached stable with M41 and Chrome 41 was released on March 3. I haven't heard anything and can't find any bug report, so it worked out well. Please remove from spec :)
Comment 7 Simon Pieters 2015-04-02 09:37:32 UTC
OK, removed.

https://github.com/w3c/csswg-drafts/commit/a7d1486917739758f84e3324d8082632f94509a8

Tab, please make css-syntax not create an at-rule for @charset and then reassign to me, so CSSOM doesn't need to check for it in insertRule.
Comment 8 Tab Atkins Jr. 2015-04-08 22:03:54 UTC
(In reply to Simon Pieters from comment #7)
> Tab, please make css-syntax not create an at-rule for @charset and then
> reassign to me, so CSSOM doesn't need to check for it in insertRule.

Done.  It's now explicitly defined as not a valid rule, and the first one in a stylesheet is explicitly dropped during stylesheet parsing, so grammar-checking that requires some rules (like @import) to be first in the stylesheet won't get messed up.
Comment 10 Philip Jägenstedt 2015-04-14 11:49:40 UTC
Thanks all!