Skip to content
Permalink
Browse files

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
  • Loading branch information
crisbeto authored and kara committed Dec 11, 2019
1 parent bed62b1 commit 9bff8e73c58dfbcbe46f4a7fcf82515fcb1d83f3
Showing with 6 additions and 2 deletions.
  1. +6 −2 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;
}
}

0 comments on commit 9bff8e7

Please sign in to comment.
You can’t perform that action at this time.