diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-03-18 17:22:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-18 17:22:55 -0400 |
commit | 34fda66dfa5528f2b10a873e9a67417c6986c712 (patch) | |
tree | 8994cc26cc41a45bbc189622871b4a1c0b378f18 /components/script/dom/range.rs | |
parent | 0fac8f2f62aff22897a0ca657a840333827cabf0 (diff) | |
parent | 4b8282b3b164771e3351c2a85890167ab6d0ab7f (diff) | |
download | servo-34fda66dfa5528f2b10a873e9a67417c6986c712.tar.gz servo-34fda66dfa5528f2b10a873e9a67417c6986c712.zip |
Auto merge of #22891 - georgeroman:implement_cdatasection, r=Manishearth
Implement CDATASection interface and createCDATASection method
<!-- Please describe your changes on the following line: -->
---
<!-- 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 fix #22846
<!-- 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. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22891)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/range.rs')
-rw-r--r-- | components/script/dom/range.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index 5a81ba595b6..630c4acd245 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -707,14 +707,14 @@ impl RangeMethods for Range { } match start_node.type_id() { // Handled under step 2. - NodeTypeId::CharacterData(CharacterDataTypeId::Text) => (), + NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => (), NodeTypeId::CharacterData(_) => return Err(Error::HierarchyRequest), _ => (), } // Step 2. - let (reference_node, parent) = - if start_node.type_id() == NodeTypeId::CharacterData(CharacterDataTypeId::Text) { + let (reference_node, parent) = match start_node.type_id() { + NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => { // Step 3. let parent = match start_node.GetParentNode() { Some(parent) => parent, @@ -723,11 +723,13 @@ impl RangeMethods for Range { }; // Step 5. (Some(DomRoot::from_ref(&*start_node)), parent) - } else { + }, + _ => { // Steps 4-5. let child = start_node.ChildNodes().Item(start_offset); (child, DomRoot::from_ref(&*start_node)) - }; + }, + }; // Step 6. Node::ensure_pre_insertion_validity(node, &parent, reference_node.deref())?; @@ -955,7 +957,7 @@ impl RangeMethods for Range { NodeTypeId::Document(_) | NodeTypeId::DocumentFragment => None, NodeTypeId::Element(_) => Some(DomRoot::downcast::<Element>(node).unwrap()), NodeTypeId::CharacterData(CharacterDataTypeId::Comment) | - NodeTypeId::CharacterData(CharacterDataTypeId::Text) => node.GetParentElement(), + NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => node.GetParentElement(), NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) | NodeTypeId::DocumentType => unreachable!(), }; |