[csswg-drafts] [cssom] Algorithm of "insert a CSS rule" should check the index first

upsuper has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== [cssom] Algorithm of "insert a CSS rule" should check the index 
first ==
All mainstream browsers agree with the same behavior that the index is
 checked first. Parsing the rule is obviously more expensive than 
checking the index, so we shouldn't try to parse it if the index is 
already invalid.

Test case:
```html
<!DOCTYPE html>
<style></style>
<script>
  var sheet = document.styleSheets[0];
  sheet.insertRule(">", 1);
</script>
```

This test case yields index error on Firefox, Chrome, and Edge, and if
 you change the index argument to `0`, they all show a syntax error, 
which indicates they do have a different steps than what is speced.

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/753 using your GitHub 
account

Received on Thursday, 24 November 2016 00:34:12 UTC