From 6eb6e386c18663424c9b94125622bc9dd722c966 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 9 Apr 2015 00:53:28 +0200 Subject: [PATCH] Add links to CharacterData's spec --- components/script/dom/characterdata.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index 2b730469582..df173ff1787 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -70,42 +70,50 @@ impl CharacterData { } impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> { + // https://dom.spec.whatwg.org/#dom-characterdata-data fn Data(self) -> DOMString { // FIXME(https://github.com/rust-lang/rust/issues/23338) let data = self.data.borrow(); data.clone() } + // https://dom.spec.whatwg.org/#dom-characterdata-data fn SetData(self, arg: DOMString) -> ErrorResult { *self.data.borrow_mut() = arg; Ok(()) } + // https://dom.spec.whatwg.org/#dom-characterdata-length fn Length(self) -> u32 { // FIXME(https://github.com/rust-lang/rust/issues/23338) let data = self.data.borrow(); data.chars().count() as u32 } + // https://dom.spec.whatwg.org/#dom-characterdata-substringdata fn SubstringData(self, offset: u32, count: u32) -> Fallible { // FIXME(https://github.com/rust-lang/rust/issues/23338) let data = self.data.borrow(); Ok(data.slice_chars(offset as usize, (offset + count) as usize).to_owned()) } + // https://dom.spec.whatwg.org/#dom-characterdata-appenddata fn AppendData(self, arg: DOMString) -> ErrorResult { self.data.borrow_mut().push_str(arg.as_slice()); Ok(()) } + // https://dom.spec.whatwg.org/#dom-characterdata-insertdata fn InsertData(self, offset: u32, arg: DOMString) -> ErrorResult { self.ReplaceData(offset, 0, arg) } + // https://dom.spec.whatwg.org/#dom-characterdata-deletedata fn DeleteData(self, offset: u32, count: u32) -> ErrorResult { self.ReplaceData(offset, count, "".to_owned()) } + // https://dom.spec.whatwg.org/#dom-characterdata-replacedata fn ReplaceData(self, offset: u32, count: u32, arg: DOMString) -> ErrorResult { let length = self.data.borrow().chars().count() as u32; if offset > length {