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

View file

@ -516,8 +516,7 @@ impl HTMLElementMethods for HTMLElement {
// https://html.spec.whatwg.org/multipage/#dom-translate // https://html.spec.whatwg.org/multipage/#dom-translate
fn SetTranslate(&self, yesno: bool) { fn SetTranslate(&self, yesno: bool) {
self.upcast::<Element>().set_string_attribute( self.upcast::<Element>().set_string_attribute(
// TODO change this to local_name! when html5ever updates &html5ever::local_name!("translate"),
&LocalName::from("translate"),
match yesno { match yesno {
true => DOMString::from("yes"), true => DOMString::from("yes"),
false => DOMString::from("no"), false => DOMString::from("no"),

View file

@ -1,4 +0,0 @@
[translate-enumerated-ascii-case-insensitive.html]
[keyword yes]
expected: FAIL

View file

@ -1,3 +0,0 @@
[translate-enumerated-ascii-case-insensitive.html]
[keyword yes]
expected: FAIL