servo: Merge #3087 - node.textContent and node.nodeValue should not throw; r=Ms2ger (from Manishearth:node-textcontent-throws)

Source-Repo: https://github.com/servo/servo
Source-Revision: 251d818de29b97d8cf4a2398661a71c60cd89da8
This commit is contained in:
Manish Goregaokar 2014-08-14 15:37:42 +02:00
Родитель 47f5d0c606
Коммит 8730a285c0
2 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -18,7 +18,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataCast, NodeBase, NodeDeri
use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, EventTargetCast}; use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, EventTargetCast};
use dom::bindings::codegen::InheritTypes::{HTMLLegendElementDerived, HTMLFieldSetElementDerived}; use dom::bindings::codegen::InheritTypes::{HTMLLegendElementDerived, HTMLFieldSetElementDerived};
use dom::bindings::codegen::InheritTypes::HTMLOptGroupElementDerived; use dom::bindings::codegen::InheritTypes::HTMLOptGroupElementDerived;
use dom::bindings::error::{ErrorResult, Fallible, NotFound, HierarchyRequest, Syntax}; use dom::bindings::error::{Fallible, NotFound, HierarchyRequest, Syntax};
use dom::bindings::global::{GlobalRef, Window}; use dom::bindings::global::{GlobalRef, Window};
use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, Root, OptionalUnrootable}; use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, Root, OptionalUnrootable};
use dom::bindings::js::{OptionalSettable, TemporaryPushable, OptionalRootedRootable}; use dom::bindings::js::{OptionalSettable, TemporaryPushable, OptionalRootedRootable};
@ -1557,14 +1557,14 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// http://dom.spec.whatwg.org/#dom-node-nodevalue // http://dom.spec.whatwg.org/#dom-node-nodevalue
fn SetNodeValue(&self, val: Option<DOMString>) -> ErrorResult { fn SetNodeValue(&self, val: Option<DOMString>) {
match self.type_id { match self.type_id {
CommentNodeTypeId | CommentNodeTypeId |
TextNodeTypeId | TextNodeTypeId |
ProcessingInstructionNodeTypeId => { ProcessingInstructionNodeTypeId => {
self.SetTextContent(val) self.SetTextContent(val)
} }
_ => Ok(()) _ => {}
} }
} }
@ -1596,7 +1596,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
} }
// http://dom.spec.whatwg.org/#dom-node-textcontent // http://dom.spec.whatwg.org/#dom-node-textcontent
fn SetTextContent(&self, value: Option<DOMString>) -> ErrorResult { fn SetTextContent(&self, value: Option<DOMString>) {
let value = null_str_as_empty(&value); let value = null_str_as_empty(&value);
match self.type_id { match self.type_id {
DocumentFragmentNodeTypeId | DocumentFragmentNodeTypeId |
@ -1627,7 +1627,6 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
DoctypeNodeTypeId | DoctypeNodeTypeId |
DocumentNodeTypeId => {} DocumentNodeTypeId => {}
} }
Ok(())
} }
// http://dom.spec.whatwg.org/#dom-node-insertbefore // http://dom.spec.whatwg.org/#dom-node-insertbefore

Просмотреть файл

@ -46,9 +46,9 @@ interface Node : EventTarget {
[Pure] [Pure]
readonly attribute Node? nextSibling; readonly attribute Node? nextSibling;
[SetterThrows, Pure] [Pure]
attribute DOMString? nodeValue; attribute DOMString? nodeValue;
[SetterThrows, Pure] [Pure]
attribute DOMString? textContent; attribute DOMString? textContent;
void normalize(); void normalize();