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

[cssom] Algorithm of "insert a CSS rule" should check the index first #753

Closed
upsuper opened this issue Nov 24, 2016 · 0 comments
Closed
Labels

Comments

@upsuper
Copy link
Member

upsuper commented Nov 24, 2016

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:

<!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.

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

No branches or pull requests

1 participant