Add a dummy implementation of contentEditable

This commit is contained in:
Alan Jeffrey 2020-04-21 16:56:58 -05:00
parent b60c70bab6
commit c00eb62090
3 changed files with 24 additions and 15 deletions

View file

@ -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::<Element>()
.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) { fn append_text_node_to_fragment(document: &Document, fragment: &DocumentFragment, text: String) {

View file

@ -5,7 +5,7 @@
// https://html.spec.whatwg.org/multipage/#elementcontenteditable // https://html.spec.whatwg.org/multipage/#elementcontenteditable
[Exposed=Window] [Exposed=Window]
interface mixin ElementContentEditable { interface mixin ElementContentEditable {
// [CEReactions] [CEReactions]
// attribute DOMString contentEditable; attribute DOMString contentEditable;
// readonly attribute boolean isContentEditable; readonly attribute boolean isContentEditable;
}; };

View file

@ -2403,9 +2403,6 @@
[HTMLMeterElement interface: document.createElement("meter") must inherit property "value" with the proper type] [HTMLMeterElement interface: document.createElement("meter") must inherit property "value" with the proper type]
expected: FAIL expected: FAIL
[HTMLElement interface: attribute isContentEditable]
expected: FAIL
[HTMLEmbedElement interface: attribute align] [HTMLEmbedElement interface: attribute align]
expected: FAIL expected: FAIL
@ -2616,9 +2613,6 @@
[HTMLInputElement interface: document.createElement("input") must inherit property "useMap" with the proper type] [HTMLInputElement interface: document.createElement("input") must inherit property "useMap" with the proper type]
expected: FAIL expected: FAIL
[HTMLElement interface: document.createElement("noscript") must inherit property "isContentEditable" with the proper type]
expected: FAIL
[HTMLAreaElement interface: attribute ping] [HTMLAreaElement interface: attribute ping]
expected: FAIL expected: FAIL
@ -3234,9 +3228,6 @@
[HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "trueSpeed" with the proper type] [HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "trueSpeed" with the proper type]
expected: FAIL expected: FAIL
[HTMLElement interface: attribute contentEditable]
expected: FAIL
[HTMLInputElement interface: createInput("file") must inherit property "align" with the proper type] [HTMLInputElement interface: createInput("file") must inherit property "align" with the proper type]
expected: FAIL expected: FAIL
@ -3579,9 +3570,6 @@
[HTMLTableCellElement interface: document.createElement("th") must inherit property "ch" with the proper type] [HTMLTableCellElement interface: document.createElement("th") must inherit property "ch" with the proper type]
expected: FAIL 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] [HTMLTextAreaElement interface: document.createElement("textarea") must inherit property "autocomplete" with the proper type]
expected: FAIL expected: FAIL