Re: [whatwg/dom] Make the DOMTokenList creation steps use "get an attribute value" (#670)

Just a few thoughts.

#### Current behavior
* Uses "get an attribute by namespace and local name", which returns an `Attr` node or `null`
* This probably works 99% of the time because the majority of elements are created without attributes and therefore, "get an attribute by namespace and local name" would return null.
* If the value is null, the "attribute change steps" would use "Step 1" and empty the *token set*.
* If the value is an `Attr` node, the "attribute change steps" will use "Step 2" and will try to run the "ordered set parsing" steps on the `Attr` node. (I guess the best case scenario here is that it gets serialized to "[object Attr]" and the "ordered set parsing" steps return a new *token set* containing "[object" and "Attr]")

#### New behavior
* Uses "get an attribute value", which always returns a string.
* The "attribute change steps" will now always use "Step 2", which runs the string through the "ordered set parsing" steps. (This now always replaces the *token set* with a new *token set* instead of just emptying the existing *token set* when an attribute with the associated local name is not present, since we always pass a string unlike the current behavior, which passes null when the attribute is not present.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/670#issuecomment-408185423

Received on Thursday, 26 July 2018 18:08:43 UTC