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

Avoid setAttribute errors from invalid attributes, fixes #392 #509

Merged
merged 1 commit into from
Jan 7, 2019

Conversation

gijsk
Copy link
Contributor

@gijsk gijsk commented Jan 7, 2019

The original markup that trips these exceptions is things that look like <table width="90% border="0> which gets you an attribute with name 0; passing that (or something with a "." or other invalid characters) to setAttribute can throw an exception, which we should catch.

@gijsk gijsk requested a review from msujaws January 7, 2019 11:47
@gijsk
Copy link
Contributor Author

gijsk commented Jan 7, 2019

As noted in #392, I tried to use element.attributes.setNamedItem first, but I can't cloneNode attribute instances in jsdom ( jsdom/jsdom#2478 ) and so I couldn't figure out how to make that work. I think in general we don't care about these attributes anyway (only really about valid HTML attrs), so we might as well drop them on the floor when setting them doesn't work.

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.

2 participants