RESOLVED CONFIGURATION CHANGED40578
insertRule throws exception for @namespace
https://bugs.webkit.org/show_bug.cgi?id=40578
Summary insertRule throws exception for @namespace
Jos van den Oever
Reported 2010-06-14 11:15:53 PDT
Created attachment 58673 [details] html with javascript that calls insertRule Programmatically building a stylesheet is currently not possible since the insertRule function throws and exception if a rule is added that contains an '@'. This works fine in Firefox 3.6.3. http://www.w3.org/TR/DOM-Level-2-Style/css.html <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>CSS: insertRule with @namespace gives exception</title> <style type="text/css" id='css'> </style> <script type="text/javascript" charset="utf-8"> function init() { var stylesheet = document.getElementById('css').sheet; stylesheet.insertRule( '@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0)', stylesheet.cssRules.length); document.getElementById('body').innerHTML = 'Call to insertRule was ok.'; } </script> </head> <body onload='init()' id='body'> insertRule has not been called yet. </body> </html>
Attachments
html with javascript that calls insertRule (612 bytes, text/xml)
2010-06-14 11:15 PDT, Jos van den Oever
no flags
Jos van den Oever
Comment 1 2010-06-14 11:32:36 PDT
The problem in the snippet below. For some reason, namespacedeclarations are not allowed. WebCore/css/CSSParser.cpp:245 PassRefPtr<CSSRule> CSSParser::parseRule(CSSStyleSheet* sheet, const String& string) { m_styleSheet = sheet; m_allowNamespaceDeclarations = false; setupParser("@-webkit-rule{", string, "} "); cssyyparse(this); return m_rule.release(); }
Alexey Proskuryakov
Comment 2 2010-06-14 16:39:06 PDT
This line was added in <http://trac.webkit.org/changeset/51608>, but the test failed before that (it fails for me in Safari 4.0.5).
Brent Fulgham
Comment 3 2022-07-11 17:16:39 PDT
Safari, Chrome, and Firefox show the same rendering behavior for this test case. I do not believe any further compatibility issue remains.
Radar WebKit Bug Importer
Comment 4 2022-07-11 17:17:15 PDT
Note You need to log in before you can comment on or make changes to this bug.