-
Notifications
You must be signed in to change notification settings - Fork 359
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
Fix setElementContents for outerHTML #4182
Fix setElementContents for outerHTML #4182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @ThoWagen -- just one small suggestion!
if (property !== 'outerHTML') { | ||
// Set any attributes (N.B. has to be done before scripts in case they rely on the attributes): | ||
Object.entries(attrs).forEach(([attr, value]) => elm.setAttribute(attr, value)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we perhaps add something like:
} | |
} else { | |
console.error("Incompatible parameters passed to setElementContents()."); | |
} |
...just so there's a bit of feedback if somebody attempts something illegal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but only when the 'attrs' is actually not empty. I added it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good point -- thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @ThoWagen! Looks good, and all tests are passing on my end.
Fixing a bug discovered in #3918