Sanitize while parsing - #12645
Conversation
2e43740 to
3ae9149
Compare
22ab343 to
6714ff1
Compare
otherdaniel
left a comment
There was a problem hiding this comment.
Generally looks good to me, but I don't think I fully understand the subtleties here.
I had expected some sort of sanitizer tie-in somewhere around "create an element for a token" (parsing.html#create-an-element-for-the-token), to close the custom element/is-attribute loopholes. Did I overlook something?
You didn't, that would be a follow up where we apply the sanitizer on a token in particular situations. I added a comment to the OP about this. |
5814031 to
b7dd067
Compare
| <li> | ||
| <p><span data-x="list iterate">For each</span> <var>child</var> of <var>node</var>'s <span | ||
| data-x="concept-tree-child">children</span>:</p> | ||
| <p>If <var>configuration</var>["<code |
There was a problem hiding this comment.
I wonder if it would be cleaner to have something like:
- If configuration["processingInstructions"] exists, then:
- Return whether configuration["processingInstructions"] contains piTarget.
- Otherwise, return whether configuration["removeProcessingInstructions"] does not contain piTarget.
First time reading this the fallthrough from 1.1. tripped to 3. tripped me up.
There was a problem hiding this comment.
This wouldn't be according to the spec style, but I reworded it a bit to be more readable perhaps
|
Nice, I am not an expert on the parser, but that actually looks like quite an elegant integration. Especially the I also really like how much cleaner the the sanitize algorithm looks now. This does not yet handle the |
Right, I was planning to do that as a follow up. |
Editorial: style and line length improvements in Sanitizer algorithms Editorial: restore sanitize/sanitized cross-references in domintro blocks Editorial: undo unnecessary line wrapping on Document node insertion check Create fragment in the inert document Editorial: remove unreachable null checks of adjusted insertion location result adjusted insertion location is never null Preserve reference child in insertion redirection for foster parenting ref-node Restored explanatory notes for redirection map and reference node with correct formatting and indentation Remove redundant parse HTML
b7dd067 to
9c3dc52
Compare
|
Closing in favor of #12756 (stacked PR) |
Instead of parsing into a fragment and then statically sanitizing that fragment, sanitize as we parse.
This entails the following changes:
DocumentFragment, and also to redirect elements to their nearest non-replaced ancestor when a child is stripped but its children are kept.Note that this still leaves out important follow ups, where we need to sometimes sanitize before the element is even created (e.g. declarative shadow roots and
is), and having a live sanitizer config while parsing gives us the infrastructure for that.Closes #12560
Closes #12543
(See WHATWG Working Mode: Changes for more details.)
/dynamic-markup-insertion.html ( diff )
/parsing.html ( diff )