-
Notifications
You must be signed in to change notification settings - Fork 779
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(utils): remove attributes from source string #2803
Conversation
Went with using the node itself to apply css selector matching. |
node.appendChild(filterHtmlAttrs(child, filterAttrs)); | ||
}); | ||
|
||
return node; |
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.
Why is this returning elements? Isn't doing a bit of string manipulation much faster than creating entirely new DOM structures?
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.
If we're matching CSS selectors we cannot work on just strings. I wanted to remove attributes but IE11 wouldn't remove value
from an input element so had to instead recreate the DOM from scratch. Since the elements are not part of the DOM they shouldn't incur any performance penalties by reflow or repaints.
Remove unwanted attributes from source string. Will add all the audit code around it in another pr so this one doesn't get too big.
For the record; this does add a small feature, but it is a feature necessary to address a security fix that will need to be applied to all supported minor versions of axe-core. We are therefor tagging this as a "fix" instead of a "feat".