Merge pull request #3215 from nazar-pc/fix-for-missing-_query-method

Fix for `Polymer.dom(...)._query()` method doesn't exist which causes `Polymer.updateStyles()` to fail
This commit is contained in:
Steve Orvell 2016-01-05 10:43:04 -08:00
commit 7c20170d69
2 changed files with 26 additions and 3 deletions

View File

@ -26,6 +26,28 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return TreeApi.arrayCopy(this.node.querySelectorAll(selector));
},
_query: function(matcher, node) {
node = node || this.node;
var list = [];
this._queryElements(node.childNodes, matcher, list);
return list;
},
_queryElements: function(elements, matcher, list) {
for (var i=0, l=elements.length, c; (i<l) && (c=elements[i]); i++) {
if (c.nodeType === Node.ELEMENT_NODE) {
this._queryElement(c, matcher, list);
}
}
},
_queryElement: function(node, matcher, list) {
if (matcher(node)) {
list.push(node);
}
this._queryElements(node.childNodes, matcher, list);
},
getOwnerRoot: function() {
var n = this.node;
while (n) {
@ -57,7 +79,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
Object.defineProperties(DomApi.prototype, {
childNodes: {
get: function() {
return TreeApi.arrayCopyChildNodes(this.node);
@ -108,7 +130,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
};
forwardMethods(['cloneNode', 'appendChild', 'insertBefore',
'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute',
'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute',
'querySelector']);
var forwardProperties = function(f$) {
@ -131,4 +153,4 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'lastElementChild', 'nextElementSibling', 'previousElementSibling']);
})();
</script>
</script>

View File

@ -62,6 +62,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// 'unit/styling-cross-scope-apply.html?dom=shadow',
'unit/styling-cross-scope-unknown-host.html',
'unit/custom-style.html',
'unit/custom-style.html?dom=shadow',
'unit/custom-style-late.html',
'unit/dynamic-import.html',
'unit/templatizer.html',