diff --git a/src/lib/experimental/patch-dom.html b/src/lib/experimental/patch-dom.html
index b8d424efee..d326d393d0 100644
--- a/src/lib/experimental/patch-dom.html
+++ b/src/lib/experimental/patch-dom.html
@@ -27,8 +27,6 @@
return;
}
- count = 0;
-
var baseFinishDistribute = Polymer.Base._finishDistribute;
var TreeApi = Polymer.TreeApi;
var DomApi = Polymer.DomApi;
@@ -118,8 +116,6 @@
var log = false;
- var count = 0;
-
var patchImpl = {
hasPrototypeDescriptors: Boolean(Object.getOwnPropertyDescriptor(
@@ -245,25 +241,8 @@
// NOTE: patch logical implementations here so we can use
// composed getters
- TreeApi.Logical.saveChildNodes = function(node) {
- if (!this.hasChildNodes(node)) {
- if (!node.__dom) {
- node.__dom = {};
- }
- node.__dom.firstChild = node.firstChild;
- node.__dom.lastChild = node.lastChild;
- node.__dom.childNodes = [];
- for (var n=TreeApi.Composed.getFirstChild(node); n;
- n=TreeApi.Composed.getNextSibling(n)) {
- n.__dom = n.__dom || {};
- n.__dom.parentNode = node;
- node.__dom.childNodes.push(n);
- n.__dom.nextSibling = TreeApi.Composed.getNextSibling(n);
- n.__dom.previousSibling = TreeApi.Composed.getPreviousSibling(n);
- }
- }
- }
-
+ // TODO(sorvell): may need to patch saveChildNodes iff the tree has
+ // already been distributed.
TreeApi.Logical.recordInsertBefore = function(node, container, ref_node) {
container.__dom.childNodes = null;
// handle document fragments
@@ -280,18 +259,6 @@
}
}
- TreeApi.Logical.getChildNodes = function(node) {
- if (this.hasChildNodes(node)) {
- return this._getChildNodes(node);
- } else {
- // TODO(sorvell): it's more correct to `Composed.getChildNodes`
- // instead of `childNodes` here but any trivial failure
- //to use Polymer.dom will result in an error.
- return node.childNodes;
- }
- };
-
-
TreeApi.Logical.getParentNode = function(node) {
return node.__dom && node.__dom.parentNode ||
TreeApi.Composed.getParentNode(node);
@@ -342,6 +309,9 @@
};
+ // TODO(sorvell): This is largely copy/pasted from the Logical tree
+ // implementation. The code could be factored such that it could be shared
+ // but there are perf trade offs to consider.
TreeApi.Composed = {
hasParentNode: function(node) {
@@ -353,10 +323,20 @@
},
getChildNodes: function(node) {
- return node.__dom.$childNodes ||
+ return this.hasChildNodes(node) ? this._getChildNodes(node) :
(!node.__patched && TreeApi.arrayCopy(node.childNodes));
},
+ _getChildNodes: function(node) {
+ if (!node.__dom.$childNodes) {
+ node.__dom.$childNodes = [];
+ for (var n=node.__dom.$firstChild; n; n=n.__dom.$nextSibling) {
+ node.__dom.$childNodes.push(n);
+ }
+ }
+ return node.__dom.$childNodes;
+ },
+
getComposedChildNodes: function(node) {
return node.__dom.$childNodes;
},
diff --git a/src/mini/shady.html b/src/mini/shady.html
index 641566da65..c06bc2fda4 100644
--- a/src/mini/shady.html
+++ b/src/mini/shady.html
@@ -46,11 +46,6 @@
if (!this._ownerShadyRoot) {
this._ownerShadyRoot = undefined;
}
- // TODO(sorvell): these could be on the domApi object?
- // there are a bunch of `__` properties that get put on the node
- // from logicalizing. These could be on `__domApi`. Initializing
- // them here is problematic because they may have been set prior
- // to upgrading.
},
// called as part of content initialization, prior to template stamping
@@ -421,8 +416,7 @@
// dirty a shadyRoot if a change may trigger reprojection!
function maybeRedistributeParent(content, host) {
// only get logical parent.
- var parent = TreeApi.Logical.hasParentNode(content) &&
- TreeApi.Logical.getParentNode(content);
+ var parent = TreeApi.Logical.getParentNode(content);
if (parent && parent.shadyRoot &&
DomApi.hasInsertionPoint(parent.shadyRoot) &&
parent.shadyRoot._distributionClean) {