Skip to content

Commit

Permalink
Fix for Polymer.dom(...)._query() method doesn't exist which causes…
Browse files Browse the repository at this point in the history
… `Polymer.updateStyles()` to fail
  • Loading branch information
nazar-pc committed Dec 18, 2015
1 parent 273ab0f commit 0eea7a6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/lib/dom-api-shadow.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@
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) {
Expand Down Expand Up @@ -57,7 +79,7 @@
});

Object.defineProperties(DomApi.prototype, {

childNodes: {
get: function() {
return TreeApi.arrayCopyChildNodes(this.node);
Expand Down Expand Up @@ -108,7 +130,7 @@
};

forwardMethods(['cloneNode', 'appendChild', 'insertBefore',
'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute',
'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute',
'querySelector']);

var forwardProperties = function(f$) {
Expand All @@ -131,4 +153,4 @@
'lastElementChild', 'nextElementSibling', 'previousElementSibling']);

})();
</script>
</script>
1 change: 1 addition & 0 deletions test/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
// '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',
Expand Down

0 comments on commit 0eea7a6

Please sign in to comment.