Skip to content

Commit

Permalink
Add missing actions in CreateContextualFragment method
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 17, 2016
1 parent 00f229d commit 2f1073e
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions components/script/dom/htmlscriptelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
};
Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[cors-redirect-worker.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

1 change: 0 additions & 1 deletion tests/wpt/metadata/fetch/api/cors/cors-redirect.html.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[cors-redirect.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[redirect-count-worker.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[redirect-count.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[redirect-origin-worker.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[redirect-origin.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[request-cache-default-conditional.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
}
}

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"],
Expand All @@ -126,6 +130,9 @@
["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>"]
];

Expand Down

0 comments on commit 2f1073e

Please sign in to comment.