Refactor the translatable attribute lightly (#30430)

This commit is contained in:
Ennui Langeweile 2023-09-26 02:05:37 -03:00 committed by GitHub
parent dff6df8912
commit 6f0cba0855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 13 deletions

View file

@ -558,10 +558,9 @@ impl Element {
// https://html.spec.whatwg.org/multipage/#translation-mode
pub fn is_translate_enabled(&self) -> bool {
// TODO change this to local_name! when html5ever updates
let name = &LocalName::from("translate");
let name = &html5ever::local_name!("translate");
if self.has_attribute(name) {
match &*self.get_string_attribute(name) {
match_ignore_ascii_case! { &*self.get_string_attribute(name),
"yes" | "" => return true,
"no" => return false,
_ => {},
@ -572,7 +571,7 @@ impl Element {
return elem.is_translate_enabled();
}
}
true // whatwg/html#5239
true
}
// https://html.spec.whatwg.org/multipage/#the-directionality