diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 695cdbe6a493..4c4d86f16423 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -568,6 +568,27 @@ impl HTMLElementMethods for HTMLElement { }, ); } + + // https://html.spec.whatwg.org/multipage/#dom-contenteditable + fn ContentEditable(&self) -> DOMString { + // TODO: https://github.com/servo/servo/issues/12776 + self.upcast::() + .get_attribute(&ns!(), &local_name!("contenteditable")) + .map(|attr| DOMString::from(&**attr.value())) + .unwrap_or_else(|| DOMString::from("inherit")) + } + + // https://html.spec.whatwg.org/multipage/#dom-contenteditable + fn SetContentEditable(&self, _: DOMString) { + // TODO: https://github.com/servo/servo/issues/12776 + warn!("The contentEditable attribute is not implemented yet"); + } + + // https://html.spec.whatwg.org/multipage/#dom-contenteditable + fn IsContentEditable(&self) -> bool { + // TODO: https://github.com/servo/servo/issues/12776 + false + } } fn append_text_node_to_fragment(document: &Document, fragment: &DocumentFragment, text: String) { diff --git a/components/script/dom/webidls/ElementContentEditable.webidl b/components/script/dom/webidls/ElementContentEditable.webidl index ba7966c225dc..8429700e93eb 100644 --- a/components/script/dom/webidls/ElementContentEditable.webidl +++ b/components/script/dom/webidls/ElementContentEditable.webidl @@ -5,7 +5,7 @@ // https://html.spec.whatwg.org/multipage/#elementcontenteditable [Exposed=Window] interface mixin ElementContentEditable { - // [CEReactions] - // attribute DOMString contentEditable; - // readonly attribute boolean isContentEditable; + [CEReactions] + attribute DOMString contentEditable; + readonly attribute boolean isContentEditable; }; diff --git a/tests/wpt/metadata/html/dom/idlharness.https.html.ini b/tests/wpt/metadata/html/dom/idlharness.https.html.ini index 1456f232136f..e3b55e1876a1 100644 --- a/tests/wpt/metadata/html/dom/idlharness.https.html.ini +++ b/tests/wpt/metadata/html/dom/idlharness.https.html.ini @@ -2403,9 +2403,6 @@ [HTMLMeterElement interface: document.createElement("meter") must inherit property "value" with the proper type] expected: FAIL - [HTMLElement interface: attribute isContentEditable] - expected: FAIL - [HTMLEmbedElement interface: attribute align] expected: FAIL @@ -2616,9 +2613,6 @@ [HTMLInputElement interface: document.createElement("input") must inherit property "useMap" with the proper type] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "isContentEditable" with the proper type] - expected: FAIL - [HTMLAreaElement interface: attribute ping] expected: FAIL @@ -3234,9 +3228,6 @@ [HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "trueSpeed" with the proper type] expected: FAIL - [HTMLElement interface: attribute contentEditable] - expected: FAIL - [HTMLInputElement interface: createInput("file") must inherit property "align" with the proper type] expected: FAIL @@ -3579,9 +3570,6 @@ [HTMLTableCellElement interface: document.createElement("th") must inherit property "ch" with the proper type] expected: FAIL - [HTMLElement interface: document.createElement("noscript") must inherit property "contentEditable" with the proper type] - expected: FAIL - [HTMLTextAreaElement interface: document.createElement("textarea") must inherit property "autocomplete" with the proper type] expected: FAIL