W3C home > Mailing lists > Public > www-style@w3.org > February 2013

[css3-conditional] specifying behavior of CSSGroupingRule.insertRule

From: L. David Baron <dbaron@dbaron.org>
Date: Thu, 7 Feb 2013 13:33:48 -0800
To: www-style@w3.org
Message-ID: <20130207213348.GA12149@crum.dbaron.org>
The remaining issue on css3-conditional that needs to be resolved
before it goes to CR is specifying the behavior of insertRule
correctly.

In particular, it needs to specify:
 * when it throws SYNTAX_ERR (in particular, whether it does when
   the input string is something other than a single syntactically
   valid CSS rule, e.g., when it's the empty string, when it
   contains garbage after a rule, or when it contains more than one
   rule)
 * what the return value is

Existing implementations don't appear to be interoperable on the
first point, though they are on the second (it returns the index,
which is one of the function's arguments).

Chrome's behavior is that anything other than a single syntactically
valid rule throws SYNTAX_ERR.  This means an empty string, garbage
after a rule, or multiple rules, lead to SYNTAX_ERR.  This seems to
me to be a clear, simple, and reasonable behavior.  I have a test
for this behavior here:
http://lists.w3.org/Archives/Public/www-archive/2013Feb/att-0012/test_group_insertRule_option1.html

Firefox and IE behave differently.  They don't throw for an empty
string, garbage after a rule, or multiple rules.  I wrote a test for
what I considered an alternative clear, simple, and reasonable
behavior here:
http://lists.w3.org/Archives/Public/www-archive/2013Feb/att-0012/test_group_insertRule_option2.html
testing that any number of rules were inserted, and garbage dropped,
just as in a style sheet.  However, the actual behavior of
implementations doesn't match this test; neither Firefox nor IE
throws SYNTAX_ERR when multiple rules are given; Firefox inserts the
first rule only, and IE inserts no rules at all.

So my conclusion is that I'd like to specify the WebKit behavior
here, i.e., the option1 test above.

I expect these clarifications should also apply to
CSSStyleSheet.insertRule as well.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Thursday, 7 February 2013 21:34:11 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:05 GMT