Skip to content

Commit

Permalink
Fix web-platform-tests#3193. Remove console.log and unnecessary utili…
Browse files Browse the repository at this point in the history
…ty functions (web-platform-tests#3204)
  • Loading branch information
hayatoito authored and ddorwin committed Sep 13, 2016
1 parent 4d72571 commit 9a00fd1
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions shadow-dom/resources/shadow-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,6 @@ function removeWhiteSpaceOnlyTextNodes(node)
}
}

function convertTemplatesToShadowRootsWithin(node) {
var nodes = node.querySelectorAll("template");
for (var i = 0; i < nodes.length; ++i) {
var template = nodes[i];
var mode = template.getAttribute("data-mode");
var parent = template.parentNode;
parent.removeChild(template);
var shadowRoot;
if (!mode || mode == 'v0'){
shadowRoot = parent.createShadowRoot();
} else {
shadowRoot = parent.attachShadow({'mode': mode});
}
var expose = template.getAttribute("data-expose-as");
if (expose)
window[expose] = shadowRoot;
if (template.id)
shadowRoot.id = template.id;
var fragments = document.importNode(template.content, true);
shadowRoot.appendChild(fragments);

convertTemplatesToShadowRootsWithin(shadowRoot);
}
}

function isShadowHost(node)
{
return node && node.nodeType == Node.ELEMENT_NODE && node.shadowRoot;
}

function isIFrameElement(element)
{
return element && element.nodeName == 'IFRAME';
}

// Returns node from shadow/iframe tree "path".
function getNodeInComposedTree(path)
{
var ids = path.split('/');
var node = document.getElementById(ids[0]);
for (var i = 1; node != null && i < ids.length; ++i) {
if (isIFrameElement(node))
node = node.contentDocument.getElementById(ids[i]);
else if (isShadowHost(node))
node = node.shadowRoot.getElementById(ids[i]);
else
return null;
}
return node;
}

function createTestTree(node) {

let ids = {};
Expand Down Expand Up @@ -169,18 +118,6 @@ function dispatchUAEventWithLog(nodes, target, eventType, callback) {
return log;
}

function debugEventLog(log) {
for (let i = 0; i < log.length; i++) {
console.log('[' + i + '] currentTarget: ' + log[i][0] + ' target: ' + log[i][1] + ' relatedTarget: ' + log[i][2] + ' composedPath(): ' + log[i][3]);
}
}

function debugCreateTestTree(nodes) {
for (let k in nodes) {
console.log(k + ' -> ' + nodes[k]);
}
}

// This function assumes that testharness.js is available.
function assert_event_path_equals(actual, expected) {
assert_equals(actual.length, expected.length);
Expand Down

0 comments on commit 9a00fd1

Please sign in to comment.