[csswg-drafts] [cssom] Consider removing the ability to insert / remove @namespace rules from the OM.

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

== [cssom] Consider removing the ability to insert / remove @namespace rules from the OM. ==
I was fixing an edge case in Firefox's CSSOM implementation (https://bugzilla.mozilla.org/show_bug.cgi?id=1464865) when I started realizing of all the different bugs that our implementation had.

Well, turns out most of the other implementations also have them, for example, even this simple test-case:

```html
<!doctype html>
<style id="s">
</style>
<div>Should not be green</div>
<script>
  // Insert a namespace rule, remove it.
  s.sheet.insertRule('@namespace myhtml url("http://www.w3.org/1999/xhtml")', 0);
  s.sheet.deleteRule(0);
  s.sheet.insertRule('myhtml|div { color: green }', 0); // Should not be green.
</script>
```

Is wrong and shows green in every single browser. I don't even want to start thinking of preserving the order when the namespace string is the same and such. Nobody removes from the map either from my testing.

The reason this happens is because everyone to the best of my knowledge represents namespaces as a single hash map, and dealing with changes to it is slightly painful.

These bugs can of course be fixed, but I'm not aware of anyone trying to improve the situation here, and personally having the namespace map immutable at parse time would be really nice.

Is there anyone planning to fix implementations here? Or would it be reasonable to consider trying to drop deletion / insertion of namespace rules via the OM?

cc @lilles @FremyCompany @zcorpan 

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

Received on Monday, 28 May 2018 22:21:54 UTC