[dom] Attributes do not need a name slot for web compat (#110)

https://dom.spec.whatwg.org/#concept-attribute-name

This is an issue I noticed while investigating https://code.google.com/p/chromium/issues/detail?id=502301, trying to replace all case-insensitive attribute lookups in Blink with lowercasing of the input.

Blink doesn't store a separate attribute name, but instead just constructs a string from the prefix (if any) and localName where needed.

The [get an attribute by name](https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name) steps use the name concept in a way that does not match Blink, which can be described as:
 1. Return the first attribute with no prefix and whose localName is a case-sensitive match for *name*, if any.
 2. Return the first attribute where one of the following is true, if any:
  1. The attribute has no prefix, is on an HTML element in an HTML document, and its localName is a case-sensitive match for *name*.
  2. The attribute has a prefix and its prefix+":"+localName is a maybe-case-insenstive match for *name*

Where maybe-case-insensitive is case-insensitive for attributes on HTML elements in HTML documents and otherwise case-sensitive.

Rewriting this to match the new model it would be:
 1. If the attribute is on an HTML element in an HTML document, lowercase *name*
 2. Return the first attribute with no prefix and whose localName is a case-sensitive match for *name*, if any.
 3. Return the first attribute with a prefix where its prefix+":"+localName is case-senstive match for *name*, if any.

I'm not sure if spec'ing it like this would make sense.

@bzbarsky, how does this work in Gecko, do you actually store the name separately?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/110

Received on Thursday, 19 November 2015 21:54:28 UTC