diff options
author | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-01-27 22:45:07 -0500 |
---|---|---|
committer | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-02-12 20:54:41 -0500 |
commit | 3f8a9f63821abff0c7a284cd4d3bb75f41ea3cd4 (patch) | |
tree | 34ee55ecfa340f6899f294611e39b6b54bc02909 /components/script/dom/htmlelement.rs | |
parent | d0f64d9d56979f66a0de2f239c3fc691b45535d6 (diff) | |
download | servo-3f8a9f63821abff0c7a284cd4d3bb75f41ea3cd4.tar.gz servo-3f8a9f63821abff0c7a284cd4d3bb75f41ea3cd4.zip |
Translate attribute and its inheritance semantics
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index c5b7e6d0251..eea1d94de51 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -516,6 +516,23 @@ impl HTMLElementMethods for HTMLElement { // Step 7. Node::replace_all(Some(fragment.upcast()), self.upcast::<Node>()); } + + // https://html.spec.whatwg.org/multipage/#dom-translate + fn Translate(&self) -> bool { + self.upcast::<Element>().is_translate_enabled() + } + + // https://html.spec.whatwg.org/multipage/#dom-translate + fn SetTranslate(&self, yesno: bool) { + self.upcast::<Element>().set_string_attribute( + // TODO change this to local_name! when html5ever updates + &LocalName::from("translate"), + match yesno { + true => DOMString::from("yes"), + false => DOMString::from("no"), + }, + ); + } } fn append_text_node_to_fragment(document: &Document, fragment: &DocumentFragment, text: String) { |