mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update polymer
This commit is contained in:
parent
2a830d2a3d
commit
6f8396a6e7
8 changed files with 106 additions and 57 deletions
|
@ -580,8 +580,9 @@ return added;
|
|||
},
|
||||
_tryRemoveUndistributedNode: function (node) {
|
||||
if (this.node.shadyRoot) {
|
||||
if (node._composedParent) {
|
||||
nativeRemoveChild.call(node._composedParent, node);
|
||||
var parent = getComposedParent(node);
|
||||
if (parent) {
|
||||
nativeRemoveChild.call(parent, node);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -618,7 +619,7 @@ if (root && hostNeedsDist) {
|
|||
this._updateInsertionPoints(root.host);
|
||||
this._lazyDistribute(root.host);
|
||||
} else if (ensureComposedRemoval) {
|
||||
removeFromComposedParent(node._composedParent, node);
|
||||
removeFromComposedParent(getComposedParent(node), node);
|
||||
}
|
||||
},
|
||||
_removeDistributedChildren: function (root, container) {
|
||||
|
@ -842,7 +843,7 @@ configurable: true
|
|||
},
|
||||
parentNode: {
|
||||
get: function () {
|
||||
return this.node._lightParent || (this.node.__patched ? this.node._composedParent : this.node.parentNode);
|
||||
return this.node._lightParent || getComposedParent(this.node);
|
||||
},
|
||||
configurable: true
|
||||
},
|
||||
|
@ -964,6 +965,18 @@ DomApi.prototype._getComposedInnerHTML = function () {
|
|||
return getInnerHTML(this.node, true);
|
||||
};
|
||||
} else {
|
||||
var forwardMethods = [
|
||||
'cloneNode',
|
||||
'appendChild',
|
||||
'insertBefore',
|
||||
'removeChild',
|
||||
'replaceChild'
|
||||
];
|
||||
forwardMethods.forEach(function (name) {
|
||||
DomApi.prototype[name] = function () {
|
||||
return this.node[name].apply(this.node, arguments);
|
||||
};
|
||||
});
|
||||
DomApi.prototype.querySelectorAll = function (selector) {
|
||||
return Array.prototype.slice.call(this.node.querySelectorAll(selector));
|
||||
};
|
||||
|
@ -976,9 +989,6 @@ return n;
|
|||
n = n.parentNode;
|
||||
}
|
||||
};
|
||||
DomApi.prototype.cloneNode = function (deep) {
|
||||
return this.node.cloneNode(deep);
|
||||
};
|
||||
DomApi.prototype.importNode = function (externalNode, deep) {
|
||||
var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
|
||||
return doc.importNode(externalNode, deep);
|
||||
|
@ -1025,7 +1035,7 @@ return this.node.innerHTML = value;
|
|||
configurable: true
|
||||
}
|
||||
});
|
||||
var forwards = [
|
||||
var forwardProperties = [
|
||||
'parentNode',
|
||||
'firstChild',
|
||||
'lastChild',
|
||||
|
@ -1036,7 +1046,7 @@ var forwards = [
|
|||
'nextElementSibling',
|
||||
'previousElementSibling'
|
||||
];
|
||||
forwards.forEach(function (name) {
|
||||
forwardProperties.forEach(function (name) {
|
||||
Object.defineProperty(DomApi.prototype, name, {
|
||||
get: function () {
|
||||
return this.node[name];
|
||||
|
@ -1120,6 +1130,9 @@ node._composedChildren = null;
|
|||
addNodeToComposedChildren(node, parent, children, i);
|
||||
}
|
||||
}
|
||||
function getComposedParent(node) {
|
||||
return node.__patched ? node._composedParent : node.parentNode;
|
||||
}
|
||||
function addNodeToComposedChildren(node, parent, children, i) {
|
||||
node._composedParent = parent;
|
||||
children.splice(i >= 0 ? i : children.length, 0, node);
|
||||
|
@ -1150,6 +1163,7 @@ var p = Element.prototype;
|
|||
var matchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector;
|
||||
return {
|
||||
getLightChildren: getLightChildren,
|
||||
getComposedParent: getComposedParent,
|
||||
getComposedChildren: getComposedChildren,
|
||||
removeFromComposedParent: removeFromComposedParent,
|
||||
saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
|
||||
|
@ -1338,7 +1352,9 @@ var composed = getComposedChildren(container);
|
|||
var splices = Polymer.ArraySplice.calculateSplices(children, composed);
|
||||
for (var i = 0, d = 0, s; i < splices.length && (s = splices[i]); i++) {
|
||||
for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
|
||||
if (getComposedParent(n) === container) {
|
||||
remove(n);
|
||||
}
|
||||
composed.splice(s.index + d, 1);
|
||||
}
|
||||
d -= s.addedCount;
|
||||
|
@ -1351,6 +1367,7 @@ insertBefore(container, n, next);
|
|||
composed.splice(j, 0, n);
|
||||
}
|
||||
}
|
||||
ensureComposedParent(container, children);
|
||||
},
|
||||
_matchesContentSelect: function (node, contentElement) {
|
||||
var select = contentElement.getAttribute('select');
|
||||
|
@ -1380,6 +1397,7 @@ var getLightChildren = Polymer.DomApi.getLightChildren;
|
|||
var matchesSelector = Polymer.DomApi.matchesSelector;
|
||||
var hasInsertionPoint = Polymer.DomApi.hasInsertionPoint;
|
||||
var getComposedChildren = Polymer.DomApi.getComposedChildren;
|
||||
var getComposedParent = Polymer.DomApi.getComposedParent;
|
||||
var removeFromComposedParent = Polymer.DomApi.removeFromComposedParent;
|
||||
function distributeNodeInto(child, insertionPoint) {
|
||||
insertionPoint._distributedNodes.push(child);
|
||||
|
@ -1433,8 +1451,10 @@ node._composedParent = null;
|
|||
nativeRemoveChild.call(parentNode, node);
|
||||
}
|
||||
}
|
||||
function getComposedParent(node) {
|
||||
return node.__patched ? node._composedParent : node.parentNode;
|
||||
function ensureComposedParent(parent, children) {
|
||||
for (var i = 0, n; i < children.length; i++) {
|
||||
children[i]._composedParent = parent;
|
||||
}
|
||||
}
|
||||
function getTopDistributingHost(host) {
|
||||
while (host && hostNeedsRedistribution(host)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue