Skip to content

Commit

Permalink
shadow-dom: Provide proper arguments to DOMImplementation.createDocum…
Browse files Browse the repository at this point in the history
…ent().

Existing code did not give an argument to DOMImplementation.createDocument().
However, this is incorrect according to the definition of createDocument(),
which requires at least two arguments.

It seems that Chromium has recently tightened up a certain kind of invocations
to DOM APIs. Some tests started to fail on Chromium for this reason.
  • Loading branch information
yutak committed Oct 9, 2013
1 parent 3a17238 commit ee319df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<body>
<div id="log"></div>
<script>
var XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';

function createTextNode() {
var doc = document.implementation.createHTMLDocument('Test Document');
var node = doc.createTextNode('Text Node');
Expand All @@ -39,42 +41,42 @@
}

function createCDATASectionNode() {
var doc = document.implementation.createDocument();
var doc = document.implementation.createDocument(XHTML_NAMESPACE, 'html');
var node = doc.createCDATASection('CDATA Section Node');
doc.documentElement.appendChild(node);
return node;
}

function createAttributeNode() {
var doc = document.implementation.createDocument();
var doc = document.implementation.createDocument(XHTML_NAMESPACE, 'html');
var node = doc.createAttribute('attribute-node');
doc.documentElement.setAttributeNode(node);
return node;
}

function createDocumentFragmentNode() {
var doc = document.implementation.createDocument();
var doc = document.implementation.createDocument(XHTML_NAMESPACE, 'html');
var node = doc.createDocumentFragment();
doc.documentElement.appendChild(node);
return node;
}

function createEntityReferenceNode() {
var doc = document.implementation.createDocument();
var doc = document.implementation.createDocument(XHTML_NAMESPACE, 'html');
var node = doc.createEntityReference('entity-reference-node');
doc.documentElement.appendChild(node);
return node;
}

function createProcessingInstructionNode() {
var doc = document.implementation.createDocument();
var doc = document.implementation.createDocument(XHTML_NAMESPACE, 'html');
var node = doc.createProcessingInstruction('processing-instruction-node');
doc.documentElement.appendChild(node);
return node;
}

function createDocumentNode() {
return document.implementation.createDocument();
return document.implementation.createDocument(XHTML_NAMESPACE, 'html');
}

var factories = [
Expand Down
3 changes: 2 additions & 1 deletion shadow-dom/testcommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ function rethrowInternalErrors(e) {
}

function newDocument() {
var d = document.implementation.createDocument();
var d = document.implementation.createDocument(
'http://www.w3.org/1999/xhtml', 'html');
//FIXME remove the call below when non-prefixed API is used
addDocumentPrefixed(d);
return d;
Expand Down

0 comments on commit ee319df

Please sign in to comment.