Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle case-sensitive attributes like viewBox. #376

Merged
merged 2 commits into from
Jun 25, 2018
Merged

Conversation

justinfagnani
Copy link
Collaborator

Fixes #374

@justinfagnani justinfagnani force-pushed the viewbox branch 2 times, most recently from 2eabf98 to 8829761 Compare June 21, 2018 04:17
@intcreator
Copy link

Looking good so far!

Copy link
Member

@kevinpschaaf kevinpschaaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, need to fix a test

assert.equal(
stripExpressionDelimeters(container.innerHTML),
'<svg viewBox="0 0 100 100"></svg>');
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Edge test to pass, apparently need to strip the extra xmlns attribute when asserting. And they helpfully render the innerHTML as a self-closing tag, apparently. Sigh.

expected '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" />' to equal '<svg viewBox="0 0 100 100"></svg>'

Maybe just change it to

assert.match(stripExpressionDelimeters(container.innerHTML), /viewBox="0 0 100 100"/);

src/lit-html.ts Outdated
// so that on XML nodes with case-sensitive getAttribute() we can
// still find the attribute, which will have been lower-cased by
// the parser.
const attributeLookupName = /^[a-zA-z-]*$/.test(attributeNameInPart) ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The A-z looks like a bug.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. Nice catch

@justinfagnani justinfagnani merged commit 0cde222 into master Jun 25, 2018
@justinfagnani justinfagnani deleted the viewbox branch June 27, 2018 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants