Lit-html: MS Edge: NamedNodeMap.getNamedItem('some-attr$') throws

Created on 20 Mar 2018  路  7Comments  路  Source: Polymer/lit-html

On Edge, NamedNodeMap.getNamedItem('some-attr$') throws an InvalidCharacterError (suspect the $, which is used for attribute binding). This is used here - https://github.com/Polymer/lit-html/blob/master/src/lit-html.ts#L316

Medium Bug

All 7 comments

Along with #302, there's a possible fix here: https://github.com/Polymer/lit-html/pull/344/files#diff-7548be97e171131880082c935a962f68R326

We need a regression test though.

Should not be hard to reproduce for testing. The below code does not work in Edge 16. (https://jsfiddle.net/nf4w7o92/7/)

<script type="module">
import { html, render } from 'https://unpkg.com/[email protected]/lib/lit-extended.js';

render(html`<h2 title$="${'test'}">Should render without error</h2>`, document.body);
</script>

The tests contain scenarios where attributes contain $, e.g.

https://github.com/Polymer/lit-html/blob/1a993e74411981e623c6d66cc2fb81ff279932f5/src/test/lib/lit-extended_test.ts#L41-L44

The jsfiddle works fine in Edge 17 (see screenshot below). The tests work fine in Edge 15.
Maybe this bug only affects Edge 16? A regression test might be as simple as adding windows 10/microsoftedge@16 to the list of browsers to test in travis.

2018-06-24 11 22 37

@justinfagnani: The issue here is Edge doesn't accept invalid XML attr names, which follow different rules than HTML's attrs:

This'll also affect the proposed .prop syntax for lit-extended. You could use trailing prop. style, since NameChar allows periods.

Adding to @csvn's test cases: https://output.jsbin.com/xaliyud/quiet:

screenshot 2018-07-15 01 07 56

We have test coverage of the new syntax, but it seems like Sauce is picking Edge 15 to run the tests on. I'll keep this issue open until we make sure test also pass on 16 and 17.

This issue has been resolved, we now use .getAttribute() over .attributes.getNamedItem(), which does not break in Edge.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kaaninel picture kaaninel  路  3Comments

dflorey picture dflorey  路  4Comments

dakom picture dakom  路  4Comments

cbelden picture cbelden  路  4Comments

valdrinkoshi picture valdrinkoshi  路  5Comments