fix(ivy): inconsistent attribute casing in DebugNode.attributes on IE (#34305)
In `DebugElement.attributes` we return all of the attributes from the underlying DOM node. Most browsers change the attribute names to lower case, but IE preserves the case and since we use camel-cased attributes, the return value was inconsitent. I've changed it to always lower case the attribute names. PR Close #34305
This commit is contained in:
parent
0100a39e21
commit
c45a70c3b8
|
@ -329,10 +329,14 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ implements DebugEleme
|
|||
const eAttrs = element.attributes;
|
||||
for (let i = 0; i < eAttrs.length; i++) {
|
||||
const attr = eAttrs[i];
|
||||
const lowercaseName = attr.name.toLowerCase();
|
||||
|
||||
// Make sure that we don't assign the same attribute both in its
|
||||
// case-sensitive form and the lower-cased one from the browser.
|
||||
if (lowercaseTNodeAttrs.indexOf(attr.name) === -1) {
|
||||
attributes[attr.name] = attr.value;
|
||||
if (lowercaseTNodeAttrs.indexOf(lowercaseName) === -1) {
|
||||
// Save the lowercase name to align the behavior between browsers.
|
||||
// IE preserves the case, while all other browser convert it to lower case.
|
||||
attributes[lowercaseName] = attr.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue