mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Refactor the translatable
attribute lightly (#30430)
This commit is contained in:
parent
dff6df8912
commit
6f0cba0855
4 changed files with 4 additions and 13 deletions
|
@ -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
|
||||||
|
|
|
@ -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"),
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[translate-enumerated-ascii-case-insensitive.html]
|
|
||||||
[keyword yes]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[translate-enumerated-ascii-case-insensitive.html]
|
|
||||||
[keyword yes]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue