lang does not pierce shadow boundary
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: peter.rushforth, Unassigned)
Details
Attachments
(1 file)
658 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Steps to reproduce:
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>localization.html</title>
</head>
<body >
<host-element lang="fr">
<template shadowrootmode="open">
<div>
<!-- should be in fr $0.closest(':lang(fr)') should be div -->
</div>
</template>
</host-element>
<script>
console.log(document.querySelector('host-element').shadowRoot.querySelector('div').closest(':lang(fr)'));
// in chrome 130: <div>...</div>
// in ff 132.0: null
</script>
</body>
</html>
Actual results:
In chrome 130, lang appears to correctly? pierce the shadow boundary, however in ff 132.0, it does not. See test case provided
Expected results:
I think it should apply to shadow content, as the mdn docs say this, but it appears fuzzy to me in the html spec.
Comment 1•4 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•4 days ago
|
||
Comment 3•4 days ago
|
||
The spec is a bit broken I think, when it comes to slot elements, but other than that there is some reasonable text in https://html.spec.whatwg.org/#the-lang-and-xml:lang-attributes
The inheritance is mostly a style engine feature, I think
https://searchfox.org/mozilla-central/rev/0d0eef18ea91e38ddfb82a1ac5d6560a146da5c0/servo/components/style/invalidation/element/element_wrapper.rs#147-160
Updated•4 days ago
|
Reporter | ||
Comment 4•4 days ago
|
||
In the spec, below here: https://html.spec.whatwg.org/#the-lang-and-xml:lang-attributes there's a list of steps, and the third step appears to cover the test case
"To determine the language of a node, user agents must use the first appropriate step in the following list:"
...
If the node's parent is a shadow root
Use the language of that shadow root's host.
Description
•