Skip to content

Commit c45a70c

Browse files
crisbetokara
authored andcommitted
fix(ivy): inconsistent attribute casing in DebugNode.attributes on IE (angular#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 angular#34305
1 parent 0100a39 commit c45a70c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/src/debug/debug_node.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,14 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ implements DebugEleme
329329
const eAttrs = element.attributes;
330330
for (let i = 0; i < eAttrs.length; i++) {
331331
const attr = eAttrs[i];
332+
const lowercaseName = attr.name.toLowerCase();
333+
332334
// Make sure that we don't assign the same attribute both in its
333335
// case-sensitive form and the lower-cased one from the browser.
334-
if (lowercaseTNodeAttrs.indexOf(attr.name) === -1) {
335-
attributes[attr.name] = attr.value;
336+
if (lowercaseTNodeAttrs.indexOf(lowercaseName) === -1) {
337+
// Save the lowercase name to align the behavior between browsers.
338+
// IE preserves the case, while all other browser convert it to lower case.
339+
attributes[lowercaseName] = attr.value;
336340
}
337341
}
338342

0 commit comments

Comments
 (0)