diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-21 10:20:18 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-21 10:20:18 -0600 |
commit | d562d101809fbbb3d43511ae4cd3acbee280a7e7 (patch) | |
tree | 250b2b5e118b2d9967d114f7dd6e6ecfba96cee0 | |
parent | 6cc1976cca808cac2069b241885a9c102ee7424d (diff) | |
parent | 861bcb2b7937c965507f03e091def913f4591fd4 (diff) | |
download | servo-d562d101809fbbb3d43511ae4cd3acbee280a7e7.tar.gz servo-d562d101809fbbb3d43511ae4cd3acbee280a7e7.zip |
Auto merge of #14210 - GuillaumeGomez:fragment_node, r=nox
Add missing action in CreateContextualFragment method
r? @nox
<!-- 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/14210)
<!-- Reviewable:end -->
13 files changed, 14 insertions, 22 deletions
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 62e3cf68a86..6dd6349b185 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -595,6 +595,10 @@ impl HTMLScriptElement { is_js } + pub fn set_parser_inserted(&self, parser_inserted: bool) { + self.parser_inserted.set(parser_inserted); + } + pub fn set_already_started(&self, already_started: bool) { self.already_started.set(already_started); } diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index c0709f17c7c..8e8b9888b87 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -903,9 +903,9 @@ impl RangeMethods for Range { let node = self.StartContainer(); let element = match node.type_id() { NodeTypeId::Document(_) | NodeTypeId::DocumentFragment => None, - NodeTypeId::Element(_) => Some(node), + NodeTypeId::Element(_) => Some(Root::downcast::<Element>(node).unwrap()), NodeTypeId::CharacterData(CharacterDataTypeId::Comment) | - NodeTypeId::CharacterData(CharacterDataTypeId::Text) => node.GetParentNode(), + NodeTypeId::CharacterData(CharacterDataTypeId::Text) => node.GetParentElement(), NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) | NodeTypeId::DocumentType => unreachable!(), }; @@ -928,6 +928,7 @@ impl RangeMethods for Range { for node in fragment_node.upcast::<Node>().traverse_preorder() { if let Some(script) = node.downcast::<HTMLScriptElement>() { script.set_already_started(false); + script.set_parser_inserted(false); } } diff --git a/tests/wpt/metadata/domparsing/createContextualFragment.html.ini b/tests/wpt/metadata/domparsing/createContextualFragment.html.ini index 7602299fb12..6f8857f9abf 100644 --- a/tests/wpt/metadata/domparsing/createContextualFragment.html.ini +++ b/tests/wpt/metadata/domparsing/createContextualFragment.html.ini @@ -1,8 +1,5 @@ [createContextualFragment.html] type: testharness - [<script>s should be run when appended to the document (but not before)] - expected: FAIL - [Namespace generally shouldn't matter] expected: FAIL diff --git a/tests/wpt/metadata/fetch/api/cors/cors-redirect-worker.html.ini b/tests/wpt/metadata/fetch/api/cors/cors-redirect-worker.html.ini index 1ba0a14daac..24d34e98478 100644 --- a/tests/wpt/metadata/fetch/api/cors/cors-redirect-worker.html.ini +++ b/tests/wpt/metadata/fetch/api/cors/cors-redirect-worker.html.ini @@ -1,4 +1,3 @@ [cors-redirect-worker.html] type: testharness disabled: https://github.com/servo/servo/issues/13441 - diff --git a/tests/wpt/metadata/fetch/api/cors/cors-redirect.html.ini b/tests/wpt/metadata/fetch/api/cors/cors-redirect.html.ini index 506643337e5..3d6db839548 100644 --- a/tests/wpt/metadata/fetch/api/cors/cors-redirect.html.ini +++ b/tests/wpt/metadata/fetch/api/cors/cors-redirect.html.ini @@ -1,4 +1,3 @@ [cors-redirect.html] type: testharness disabled: https://github.com/servo/servo/issues/13441 - diff --git a/tests/wpt/metadata/fetch/api/redirect/redirect-count-worker.html.ini b/tests/wpt/metadata/fetch/api/redirect/redirect-count-worker.html.ini index c670b300644..14079a030b3 100644 --- a/tests/wpt/metadata/fetch/api/redirect/redirect-count-worker.html.ini +++ b/tests/wpt/metadata/fetch/api/redirect/redirect-count-worker.html.ini @@ -1,4 +1,3 @@ [redirect-count-worker.html] type: testharness disabled: https://github.com/servo/servo/issues/13441 - diff --git a/tests/wpt/metadata/fetch/api/redirect/redirect-count.html.ini b/tests/wpt/metadata/fetch/api/redirect/redirect-count.html.ini index 97bdf14e6ce..8e61caab146 100644 --- a/tests/wpt/metadata/fetch/api/redirect/redirect-count.html.ini +++ b/tests/wpt/metadata/fetch/api/redirect/redirect-count.html.ini @@ -1,4 +1,3 @@ [redirect-count.html] type: testharness disabled: https://github.com/servo/servo/issues/13441 - diff --git a/tests/wpt/metadata/fetch/api/redirect/redirect-origin-worker.html.ini b/tests/wpt/metadata/fetch/api/redirect/redirect-origin-worker.html.ini index fcd93545ec1..4680670cde5 100644 --- a/tests/wpt/metadata/fetch/api/redirect/redirect-origin-worker.html.ini +++ b/tests/wpt/metadata/fetch/api/redirect/redirect-origin-worker.html.ini @@ -1,4 +1,3 @@ [redirect-origin-worker.html] type: testharness disabled: https://github.com/servo/servo/issues/13441 - diff --git a/tests/wpt/metadata/fetch/api/redirect/redirect-origin.html.ini b/tests/wpt/metadata/fetch/api/redirect/redirect-origin.html.ini index a82435325cb..3b442a15f77 100644 --- a/tests/wpt/metadata/fetch/api/redirect/redirect-origin.html.ini +++ b/tests/wpt/metadata/fetch/api/redirect/redirect-origin.html.ini @@ -1,4 +1,3 @@ [redirect-origin.html] type: testharness disabled: https://github.com/servo/servo/issues/13441 - diff --git a/tests/wpt/metadata/fetch/api/request/request-cache-default-conditional.html.ini b/tests/wpt/metadata/fetch/api/request/request-cache-default-conditional.html.ini index 07b1858da77..919c03caf2a 100644 --- a/tests/wpt/metadata/fetch/api/request/request-cache-default-conditional.html.ini +++ b/tests/wpt/metadata/fetch/api/request/request-cache-default-conditional.html.ini @@ -1,4 +1,3 @@ [request-cache-default-conditional.html] type: testharness disabled: https://github.com/servo/servo/issues/13441 - diff --git a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/117.html.ini b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/117.html.ini deleted file mode 100644 index bb29063639b..00000000000 --- a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/117.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[117.html] - type: testharness - [scheduler: inline script created with createContextualFragment] - expected: FAIL - diff --git a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/118.html.ini b/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/118.html.ini deleted file mode 100644 index 7d6683b9635..00000000000 --- a/tests/wpt/metadata/old-tests/submission/Opera/script_scheduling/118.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[118.html] - type: testharness - [scheduler: external script created with createContextualFragment] - expected: FAIL - diff --git a/tests/wpt/web-platform-tests/domparsing/createContextualFragment.html b/tests/wpt/web-platform-tests/domparsing/createContextualFragment.html index d81186a9dd6..07c0883e240 100644 --- a/tests/wpt/web-platform-tests/domparsing/createContextualFragment.html +++ b/tests/wpt/web-platform-tests/domparsing/createContextualFragment.html @@ -109,6 +109,10 @@ function testEquivalence(element1, fragment1, element2, fragment2) { } } +var doc_fragment = document.createDocumentFragment(); +var comment = document.createComment("~o~"); +doc_fragment.appendChild(comment); + var tests = [ ["<html> and <body> must work the same, 1", document.documentElement, "<span>Hello world</span>", document.body, "<span>Hello world</span>"], ["<html> and <body> must work the same, 2", document.documentElement, "<body><p>Hello world", document.body, "<body><p>Hello world"], @@ -126,6 +130,9 @@ var tests = [ ["undefined should be stringified", document.createElement("span"), undefined, document.createElement("span"), "undefined"], ["Text nodes shouldn't be special", document.createTextNode("?"), "<body><p>", + document.createElement("div"), "<body><p>"], + ["Non-Element parent should not be special", + comment, "<body><p>", document.createElement("div"), "<body><p>"] ]; |