Skip to content

Stop using “strictly split” in “validate and extract”#1455

Merged
annevk merged 1 commit intomainfrom
validate-and-extract-first-colon
Mar 9, 2026
Merged

Stop using “strictly split” in “validate and extract”#1455
annevk merged 1 commit intomainfrom
validate-and-extract-first-colon

Conversation

@sideshowbarker
Copy link
Copy Markdown
Member

@sideshowbarker sideshowbarker commented Mar 6, 2026

The “validate and extract” algorithm currently uses “strictly split” to split the qualified name on U+003A (:), which splits on every colon into an array, and takes only the first and second elements from the array. For a qualified name like foo:bar:baz, that produces the prefix foo and the local name bar — silently discarding the :baz part.

This change splits on the first colon only instead, so the local name is bar:baz.

This came up in WICG/sanitizer-api#373. Fixes #1453.

This change causes the “validate and extract” algorithm to stop calling
“strictly split” and instead split on the first colon only. Given the
qualified name “foo:bar:baz”, that produces the local name “bar:baz”.

Otherwise, without this change, using “strictly split” produces the
prefix “foo” and local name “bar" — discarding the “:baz” part.

Fixes #1453
@sideshowbarker sideshowbarker changed the title Split on first colon in validate and extract Split on first colon in “validate and extract” Mar 6, 2026
@sideshowbarker sideshowbarker changed the title Split on first colon in “validate and extract” Stop using “strictly split” in “validate and extract” Mar 6, 2026
@annevk

This comment was marked as outdated.

@sideshowbarker

This comment was marked as outdated.

@josepharhar
Copy link
Copy Markdown
Contributor

Looks good to me, hopefully there are no compat issues we run into. @otherdaniel

@annevk
Copy link
Copy Markdown
Member

annevk commented Mar 6, 2026

@josepharhar are we all going to try and deploy this and report back if it breaks? @smaug---- does that work for you? If so, we might not need agenda+.

@sideshowbarker
Copy link
Copy Markdown
Member Author

For the record here, what “validate and extract” said before the patch associated with #1134 was this:

If qualifiedName contains a U+003A (:), then strictly split the string on it and set prefix to the part before and localName to the part after.

So, it was ambiguous — as #1134 pointed out. But, one of the two ways it could have been read as intending is:

If qualifiedName contains a U+003A (:), then strictly split the string on it and set prefix to the part before and localName to the part after.

In other words, it could have been read as actually intending what the change in this PR does. In other-other words, the change here is just reverting the spec back to what it had actually originally been intended to specify.

And nobody in the #1134 discussion ever explicitly instead said anything like, Throw away everything else in the name after splitting it into a list and taking just the first two list items is clearly what we had meant to require here.”

Instead, that’s just… effectively what it had ended up getting changed to state — without anybody ever having explicitly said there was some good reason for it needing to require throwing away everything else in the name.

@josepharhar
Copy link
Copy Markdown
Contributor

I thought that using strictly split meant to throw everything after the second colon away because of this discussion: #1387 (comment)

@sideshowbarker
Copy link
Copy Markdown
Member Author

sideshowbarker commented Mar 7, 2026

I thought that using strictly split meant to throw everything after the second colon away because of this discussion: #1387 (comment)

Dunno — but the PR which resulted in the local-name-computation part of the spec ending up as it is now, #1135, is from 2022. So it predates that #1387 (comment) discussion (~8 months ago) by more than 2 years. The only actual spec change made in response to that #1387 (comment) discussion was https://github.com/whatwg/dom/pull/1388/changes — which was, “If prefix is not a valid namespace prefix, then throw” (no new effect on the requirements about the local name).

@smaug----
Copy link
Copy Markdown
Contributor

@smaug---- does that work for you? If so, we might not need agenda+.

Sounds good to me

annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 9, 2026
@annevk annevk merged commit 3a80353 into main Mar 9, 2026
2 checks passed
@annevk annevk deleted the validate-and-extract-first-colon branch March 9, 2026 06:22
sideshowbarker added a commit to sideshowbarker/ladybird that referenced this pull request Mar 10, 2026
Change local-name computation in DOM::validate_and_extract() to preserve
everything after the first colon in a qualified name — matching a recent
spec change made in whatwg/dom#1455 (and
replacing a previous spec requirement to use the “strictly split”
algorithm, which resulted in throwing away any other part of the name
after any second colon the name might have).

For the qualified name “f:o:o”, this change now gives localName=“o:o”.
Otherwise, without this change, it’d instead give localName=“o”.
shannonbooth pushed a commit to LadybirdBrowser/ladybird that referenced this pull request Mar 10, 2026
Change local-name computation in DOM::validate_and_extract() to preserve
everything after the first colon in a qualified name — matching a recent
spec change made in whatwg/dom#1455 (and
replacing a previous spec requirement to use the “strictly split”
algorithm, which resulted in throwing away any other part of the name
after any second colon the name might have).

For the qualified name “f:o:o”, this change now gives localName=“o:o”.
Otherwise, without this change, it’d instead give localName=“o”.
lando-worker bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Mar 10, 2026
… extract”» change to DOM spec, r=smaug,dom-core

Change local-name computation in ParseQualifiedNameRelaxed to preserve
everything after the first colon in a qualified name — rather than, per
the spec’s “strictly split” algorithm, throwing away any other part of
the name after any second colon the name might have.

For the qualified name “f:o:o”, that now gives localName=“o:o”.
Otherwise, without this change, it would instead give localName=“o”.

See whatwg/dom#1455

Differential Revision: https://phabricator.services.mozilla.com/D286825
lando-worker bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Mar 11, 2026
… extract”» change to DOM spec, r=smaug,dom-core

Change local-name computation in ParseQualifiedNameRelaxed to preserve
everything after the first colon in a qualified name — rather than, per
the spec’s “strictly split” algorithm, throwing away any other part of
the name after any second colon the name might have.

For the qualified name “f:o:o”, that now gives localName=“o:o”.
Otherwise, without this change, it would instead give localName=“o”.

See whatwg/dom#1455

Differential Revision: https://phabricator.services.mozilla.com/D286825
lando-worker bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Mar 12, 2026
…/show_bug.cgi?id=241419, a=testonly

Automatic update from web-platform-tests
DOM: split on the first U+003A (:) only for qualified names instead of on all

Context: whatwg/dom#1455.

Source: https://bugs.webkit.org/show_bug.cgi?id=241419.
--

wpt-commits: 5a2bcb89e79ed0ea0265733c44a125138b4ba4f4
wpt-pr: 58331
raz2017 pushed a commit to raz2017/ladybird that referenced this pull request Mar 14, 2026
Change local-name computation in DOM::validate_and_extract() to preserve
everything after the first colon in a qualified name — matching a recent
spec change made in whatwg/dom#1455 (and
replacing a previous spec requirement to use the “strictly split”
algorithm, which resulted in throwing away any other part of the name
after any second colon the name might have).

For the qualified name “f:o:o”, this change now gives localName=“o:o”.
Otherwise, without this change, it’d instead give localName=“o”.
lando-worker bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Mar 15, 2026
… extract”» change to DOM spec, r=smaug,dom-core

Change local-name computation in ParseQualifiedNameRelaxed to preserve
everything after the first colon in a qualified name — rather than, per
the spec’s “strictly split” algorithm, throwing away any other part of
the name after any second colon the name might have.

For the qualified name “f:o:o”, that now gives localName=“o:o”.
Otherwise, without this change, it would instead give localName=“o”.

See whatwg/dom#1455

Differential Revision: https://phabricator.services.mozilla.com/D286825
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 20, 2026
… extract”» change to DOM spec, r=smaug,dom-core

Change local-name computation in ParseQualifiedNameRelaxed to preserve
everything after the first colon in a qualified name — rather than, per
the spec’s “strictly split” algorithm, throwing away any other part of
the name after any second colon the name might have.

For the qualified name “f:o:o”, that now gives localName=“o:o”.
Otherwise, without this change, it would instead give localName=“o”.

See whatwg/dom#1455

Differential Revision: https://phabricator.services.mozilla.com/D286825

UltraBlame original commit: bca5cc762e77c5cc3cbea3ebdf422df644558a7e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 20, 2026
… extract”» change to DOM spec, r=smaug,dom-core

Change local-name computation in ParseQualifiedNameRelaxed to preserve
everything after the first colon in a qualified name — rather than, per
the spec’s “strictly split” algorithm, throwing away any other part of
the name after any second colon the name might have.

For the qualified name “f:o:o”, that now gives localName=“o:o”.
Otherwise, without this change, it would instead give localName=“o”.

See whatwg/dom#1455

Differential Revision: https://phabricator.services.mozilla.com/D286825

UltraBlame original commit: bca5cc762e77c5cc3cbea3ebdf422df644558a7e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 20, 2026
… extract”» change to DOM spec, r=smaug,dom-core

Change local-name computation in ParseQualifiedNameRelaxed to preserve
everything after the first colon in a qualified name — rather than, per
the spec’s “strictly split” algorithm, throwing away any other part of
the name after any second colon the name might have.

For the qualified name “f:o:o”, that now gives localName=“o:o”.
Otherwise, without this change, it would instead give localName=“o”.

See whatwg/dom#1455

Differential Revision: https://phabricator.services.mozilla.com/D286825

UltraBlame original commit: bca5cc762e77c5cc3cbea3ebdf422df644558a7e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Issue with validate and extract (foo:bar:baz inputs)

4 participants