From c45a70c3b8682268159f9702e75b2a1a6b54da3e Mon Sep 17 00:00:00 2001 From: crisbeto Date: Wed, 11 Dec 2019 22:01:40 +0100 Subject: [PATCH] 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 --- packages/core/src/debug/debug_node.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/core/src/debug/debug_node.ts b/packages/core/src/debug/debug_node.ts index ca78b012ed..86e3d66b18 100644 --- a/packages/core/src/debug/debug_node.ts +++ b/packages/core/src/debug/debug_node.ts @@ -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; } }