traverse Shadow DOM boundaries when determining element lang (#34529)

Signed-off-by: Ville Lindholm <ville@lindholm.dev>
This commit is contained in:
Ville Lindholm 2024-12-08 18:50:28 +02:00 committed by GitHub
parent 3363e1a261
commit af8f35f5ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 10 deletions

View file

@ -4146,7 +4146,7 @@ impl Element {
// https://html.spec.whatwg.org/multipage/#language // https://html.spec.whatwg.org/multipage/#language
pub fn get_lang(&self) -> String { pub fn get_lang(&self) -> String {
self.upcast::<Node>() self.upcast::<Node>()
.inclusive_ancestors(ShadowIncluding::No) .inclusive_ancestors(ShadowIncluding::Yes)
.filter_map(|node| { .filter_map(|node| {
node.downcast::<Element>().and_then(|el| { node.downcast::<Element>().and_then(|el| {
el.get_attribute(&ns!(xml), &local_name!("lang")) el.get_attribute(&ns!(xml), &local_name!("lang"))

View file

@ -1,9 +0,0 @@
[lang-attribute-shadow.window.html]
[lang on slot inherits from shadow host]
expected: FAIL
[lang only on host]
expected: FAIL
[lang on host and slotted element]
expected: FAIL