Stop using “strictly split” in “validate and extract”#1455
Conversation
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
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Looks good to me, hopefully there are no compat issues we run into. @otherdaniel |
|
@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+. |
|
For the record here, what “validate and extract” said before the patch associated with #1134 was this:
So, it was ambiguous — as #1134 pointed out. But, one of the two ways it could have been read as intending is:
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. |
|
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). |
Sounds good to me |
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”.
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”.
… 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
… 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
…/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
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”.
… 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
… 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
… 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
… 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
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 prefixfooand the local namebar— silently discarding the:bazpart.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.
At least two implementers are interested (and none opposed):
Tests are written and can be reviewed and commented upon at:
Implementation bugs are filed:
https://github.com/WebKit/WebKit/pull/56000]MDN issue is filed: N/A
The top of this comment includes a clear commit message to use.