Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ text: HTML fragment parsing algorithm; type: dfn; url: https://html.spec.whatwg.
text: global attribute; type: dfn; url: https://html.spec.whatwg.org/multipage/dom.html#global-attributes
text: custom data attribute; type: dfn; url: https://html.spec.whatwg.org/multipage/dom.html#custom-data-attribute
text: report a warning to the console; type: dfn; url: https://console.spec.whatwg.org/#report-a-warning-to-the-console
text: convert nodes into a node; type: dfn; url: https://dom.spec.whatwg.org/#convert-nodes-into-a-node
</pre>
<pre class="biblio">
{
Expand Down Expand Up @@ -913,7 +914,16 @@ beginning with |node|. It consistes of these steps:
1. [=Assert=]: |node| does not [=implement=] {{Document}}.
1. Call [=sanitize core=] on |child| with |configuration| and
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

My assumption was that the top-level list/iterate would have some sort of pass-by-value semantics, i.e. that the list at the time of the iteration is fixed. In that case this is needed, because otherwise the sanitizer would never see any of the children that are replacing their parents.

Spec text says:

To iterate over a list, performing a set of steps on each item in order, [...]

That doesn't strike me as very clear either way.

I also found this discussion, which seems to resolve this in favour of supporting modifications while iterating. But the promised PR from that discussion seems to not have materialized.

Not sure what to do here... by my reading of the current spec texts, I can't find a guarantee that modify during iterate would work as expected.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

whatwg/infra#451 exists but seems to have stalled.

|handleJavascriptNavigationUrls|.
1. Call [=replace all=] with |child|'s [=tree/children=] within |child|.
1. Let |fragment| be a new {{DocumentFragment}} whose [=node document=]
is |node|'s [=node document=].
1. [=list/iterate|For each=] |innerChild| of |child|'s [=tree/children=],
[=/append=] |innerChild| to |fragment|.
1. [=/Replace=] |child| with |fragment| within |node|.

NOTE: [=/Replace=] shouldn't throw here, since the structural
preconditions for successful execution of the algorithm should
be met.

1. [=Continue=].
1. If |configuration|["{{SanitizerConfig/elements}}"] [=map/exists=]:
1. If |configuration|["{{SanitizerConfig/elements}}"] does not
Expand Down
Loading