Closed
Description
https://drafts.csswg.org/cssom-1/#dom-cssstylesheet-insertrule
- Let
parsed rule
be the return value of invoking parse a rule withrule
.- If
parsed rule
is a syntax error, returnparsed rule
.
All mainstream browsers do not return a syntax error but throws a SyntaxError
DOMException
when the result of parse a rule is a syntax error:
try {
document.styleSheets[0].insertRule(' ')
} catch (error) {
error.name // SyntaxError
error // DOMException: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule ' '.
}
Furthermore, the Web IDL definition does not allow to return syntax error:
unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0);
Should the current procedure be updated to this interopable behavior?