Remove obsolete step from Text::SplitText

https://github.com/whatwg/dom/pull/419
This commit is contained in:
Anthony Ramine 2017-03-07 13:31:22 +01:00
parent b66839367c
commit 57291e5609
2 changed files with 3 additions and 12 deletions

View file

@ -1214,12 +1214,6 @@ impl WeakRangeVec {
} }
} }
/// Used for steps 9.1-2. when splitting a text node.
/// https://dom.spec.whatwg.org/#concept-text-split
pub fn clamp_above(&self, node: &Node, offset: u32) {
self.map_offset_above(node, offset, |_| offset);
}
fn map_offset_above<F: FnMut(u32) -> u32>(&self, node: &Node, offset: u32, mut f: F) { fn map_offset_above<F: FnMut(u32) -> u32>(&self, node: &Node, offset: u32, mut f: F) {
unsafe { unsafe {
(*self.cell.get()).update(|entry| { (*self.cell.get()).update(|entry| {

View file

@ -43,7 +43,8 @@ impl Text {
} }
impl TextMethods for Text { impl TextMethods for Text {
// https://dom.spec.whatwg.org/#dom-text-splittextoffset // https://dom.spec.whatwg.org/#dom-text-splittext
// https://dom.spec.whatwg.org/#concept-text-split
fn SplitText(&self, offset: u32) -> Fallible<Root<Text>> { fn SplitText(&self, offset: u32) -> Fallible<Root<Text>> {
let cdata = self.upcast::<CharacterData>(); let cdata = self.upcast::<CharacterData>();
// Step 1. // Step 1.
@ -72,11 +73,7 @@ impl TextMethods for Text {
} }
// Step 8. // Step 8.
cdata.DeleteData(offset, count).unwrap(); cdata.DeleteData(offset, count).unwrap();
if parent.is_none() {
// Step 9. // Step 9.
node.ranges().clamp_above(&node, offset);
}
// Step 10.
Ok(new_node) Ok(new_node)
} }