Closed Bug 2033512 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 59296 - [CSS] Reject :lang() matches for ill-formed lang attributes

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox152 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 59296 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/59296
Details from upstream follow.

Felipe Erias <felipeerias@igalia.com> wrote:

[CSS] Reject :lang() matches for ill-formed lang attributes

Per CSSWG decision, any :lang() argument or lang attribute that cannot
be parsed with the BCP-47 syntax causes :lang() selectors to not match.

See: https://github.com/w3c/csswg-drafts/issues/8720

The :lang() argument was already validated. This CL adds validation for
the attribute side, so :lang() now rejects as non-matching any element
whose lang attribute value is not a well-formed BCP-47 language tag.

Fix WPT lang-singleton-subtag-matching.html because it expected a match
on a subtag 9 characters long, when spec limit is 8 chars.

Test: /css/selectors/selectors-4/lang-singleton-subtag-matching.html
Bug: 497883848
Change-Id: I57d5451e7d4ec465dbec020ca4c679e5d9748481
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7761523
Commit-Queue: Felipe Erias \<felipeerias@igalia.com>
Reviewed-by: Rune Lillesveen \<futhark@chromium.org>
Reviewed-by: Kevin Babbitt \<kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1616283}

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 30 tests and 10 subtests

Status Summary

Firefox

OK : 1
PASS: 6[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, GitHub] 35[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 4

Chrome

OK : 1
PASS: 9
FAIL: 1

Safari

OK : 1
PASS: 3
FAIL: 7

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

  • /css/selectors/selectors-4/lang-singleton-subtag-matching.html [wpt.fyi]
    • :lang(fr-x) matches lang="fr-x" and lang="fr-x-standard" (singleton "x" matches): FAIL (Chrome: PASS, Safari: FAIL)
    • :lang(fr-x) matches the correct elements: FAIL (Chrome: PASS, Safari: FAIL)
    • :lang(fr) does not match lang="fr-ninechars" (subtag exceeds 8-char limit): FAIL (Chrome: FAIL, Safari: FAIL)
    • :lang(zh-x) matches both lang="zh-x" and lang="zh-x-foobar": FAIL (Chrome: PASS, Safari: FAIL)
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
You need to log in before you can comment on or make changes to this bug.