mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
more feedback
This commit is contained in:
@@ -119,7 +119,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
return Boolean(node.__ownerShadyRoot !== undefined);
|
||||
},
|
||||
|
||||
ownerRootForNode: function(node) {
|
||||
getRootNode: function(node) {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
root = node;
|
||||
} else {
|
||||
var parent = Tree.Logical.getParentNode(node);
|
||||
root = parent ? this.ownerRootForNode(parent) : node;
|
||||
root = parent ? this.getRootNode(parent) : node;
|
||||
}
|
||||
// memo-ize result for performance but only memo-ize
|
||||
// result if node is in the document. This avoids a problem where a root
|
||||
@@ -144,7 +144,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
},
|
||||
|
||||
ownerShadyRootForNode: function(node) {
|
||||
var root = this.ownerRootForNode(node);
|
||||
var root = this.getRootNode(node);
|
||||
if (ShadyDom.isShadyRoot(root)) {
|
||||
return root;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// the issue comes up, we can force a flush in this case.
|
||||
firstComposedNode: function(insertionPoint) {
|
||||
var n$ = insertionPoint.getDistributedNodes();
|
||||
var root = this.ownerRootForNode(insertionPoint);
|
||||
var root = this.getRootNode(insertionPoint);
|
||||
for (var i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {
|
||||
// means that we're composed to this spot.
|
||||
if (root.isFinalDestination(insertionPoint, n)) {
|
||||
@@ -304,7 +304,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
var distribute = (node.localName === 'content' && name === 'select') ||
|
||||
(node.localName === 'slot' && name === 'name');
|
||||
if (distribute) {
|
||||
var root = this.ownerRootForNode(node);
|
||||
var root = this.getRootNode(node);
|
||||
if (root.update) {
|
||||
root.update();
|
||||
}
|
||||
@@ -388,7 +388,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
var NodeMixin = {
|
||||
getRootNode: function() {
|
||||
return mixinImpl.ownerRootForNode(this);
|
||||
return mixinImpl.getRootNode(this);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -819,13 +819,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
// If ANCESTOR's root is not a shadow root or ANCESTOR's root is BASE's
|
||||
// shadow-including inclusive ancestor, return ANCESTOR.
|
||||
var base = refNode;
|
||||
var baseRoot = base && ShadyDom.ownerRootForNode(base);
|
||||
var refRoot = refNode && ShadyDom.getRootNode(refNode);
|
||||
var p$ = path;
|
||||
for (var i=0, ancestor, root; i < p$.length; i++) {
|
||||
ancestor = p$[i];
|
||||
root = ShadyDom.ownerRootForNode(ancestor);
|
||||
if (!ShadyDom.isShadyRoot(root) || root === baseRoot) {
|
||||
root = ShadyDom.getRootNode(ancestor);
|
||||
if (!ShadyDom.isShadyRoot(root) || root === refRoot) {
|
||||
return ancestor;
|
||||
}
|
||||
}
|
||||
@@ -837,7 +836,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
get composed() {
|
||||
if (this.isTrusted && this.__composed === undefined) {
|
||||
this.__composed = alwaysComposed[this.type] || false;
|
||||
this.__composed = alwaysComposed[this.type];
|
||||
}
|
||||
return this.__composed || false;
|
||||
},
|
||||
@@ -1022,7 +1021,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
CustomEvent: ShadyDom.extendAll({__patched: 'CustomEvent'}, EventMixin)
|
||||
|
||||
};
|
||||
ShadyDom.ownerRootForNode = mixinImpl.ownerRootForNode;
|
||||
ShadyDom.getRootNode = mixinImpl.getRootNode;
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -21,7 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
<script>
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
var Tree = ShadyDom.Tree;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
polyfill across browsers.
|
||||
*/
|
||||
class ShadyRoot {
|
||||
|
||||
|
||||
constructor(host, useV0) {
|
||||
if (!host) {
|
||||
throw 'Must provide a host';
|
||||
@@ -58,15 +58,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// state flags
|
||||
this._clean = true;
|
||||
this._hasDistributed = false;
|
||||
this._distributor = useV0 ?
|
||||
new ShadyDom.DistributorV0(this) :
|
||||
this._distributor = useV0 ?
|
||||
new ShadyDom.DistributorV0(this) :
|
||||
new ShadyDom.DistributorV1(this);
|
||||
// TODO(sorvell): without calling update here,
|
||||
// initial distribution will not occur unless an element has been
|
||||
// TODO(sorvell): host state flags were set here next, needed?
|
||||
},
|
||||
|
||||
// async render the "top" distributor (this is all that is needed to
|
||||
// async render the "top" distributor (this is all that is needed to
|
||||
// distribute this host.
|
||||
update: function() {
|
||||
var distributionRoot = this._findDistributionRoot(this.host);
|
||||
@@ -83,7 +83,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
_findDistributionRoot: function(element) {
|
||||
var root = element.shadyRoot;
|
||||
while (element && this._elementNeedsDistribution(element)) {
|
||||
root = ShadyDom.ownerRootForNode(element);
|
||||
root = ShadyDom.getRootNode(element);
|
||||
element = root && root.host;
|
||||
}
|
||||
return root;
|
||||
@@ -96,7 +96,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
for (var i=0, c; i < c$.length; i++) {
|
||||
c = c$[i];
|
||||
if (this._distributor.isInsertionPoint(c)) {
|
||||
return ShadyDom.ownerRootForNode(element);
|
||||
return ShadyDom.getRootNode(element);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -181,7 +181,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// which informs effective children observers
|
||||
//notifyContentObservers(this);
|
||||
// TODO(sorvell): See fast paths here in Polymer v1
|
||||
// (these seem unnecessary)
|
||||
// (these seem unnecessary)
|
||||
// NOTE: send a signal to any observers
|
||||
// to report the initial set of childNodes
|
||||
if (!this._hasDistributed) {
|
||||
|
||||
@@ -139,7 +139,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
},
|
||||
_styleOwnerForNode(node) {
|
||||
var root = Polymer.Utils.ownerRootForNode(node);
|
||||
var root = Polymer.Utils.getRootNode(node);
|
||||
var host = root.host;
|
||||
if (host) {
|
||||
if (Polymer.isInstance(host)) {
|
||||
|
||||
@@ -66,7 +66,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
},
|
||||
|
||||
// only needed for v0 native ShadowDOM support
|
||||
ownerRootForNode(node) {
|
||||
getRootNode(node) {
|
||||
if (node.getRootNode) {
|
||||
return node.getRootNode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user