Auto merge of #26253 - asajeffrey:script-dummy-content-editble, r=jdm

Add a dummy implementation of contentEditable

<!-- Please describe your changes on the following line: -->

Add a dummy implementation of `contentEditable`.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because the existing wpt tests should do

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-04-22 11:32:05 -04:00 committed by GitHub
commit 84fe99b1d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) {

View file

@ -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;
};

View file

@ -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