Skip to content

Commit 0eea7a6

Browse files
committed
Fix for Polymer.dom(...)._query() method doesn't exist which causes Polymer.updateStyles() to fail
1 parent 273ab0f commit 0eea7a6

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

‎src/lib/dom-api-shadow.html‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@
2626
return TreeApi.arrayCopy(this.node.querySelectorAll(selector));
2727
},
2828

29+
_query: function(matcher, node) {
30+
node = node || this.node;
31+
var list = [];
32+
this._queryElements(node.childNodes, matcher, list);
33+
return list;
34+
},
35+
36+
_queryElements: function(elements, matcher, list) {
37+
for (var i=0, l=elements.length, c; (i<l) && (c=elements[i]); i++) {
38+
if (c.nodeType === Node.ELEMENT_NODE) {
39+
this._queryElement(c, matcher, list);
40+
}
41+
}
42+
},
43+
44+
_queryElement: function(node, matcher, list) {
45+
if (matcher(node)) {
46+
list.push(node);
47+
}
48+
this._queryElements(node.childNodes, matcher, list);
49+
},
50+
2951
getOwnerRoot: function() {
3052
var n = this.node;
3153
while (n) {
@@ -57,7 +79,7 @@
5779
});
5880

5981
Object.defineProperties(DomApi.prototype, {
60-
82+
6183
childNodes: {
6284
get: function() {
6385
return TreeApi.arrayCopyChildNodes(this.node);
@@ -108,7 +130,7 @@
108130
};
109131

110132
forwardMethods(['cloneNode', 'appendChild', 'insertBefore',
111-
'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute',
133+
'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute',
112134
'querySelector']);
113135

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

133155
})();
134-
</script>
156+
</script>

‎test/runner.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
// 'unit/styling-cross-scope-apply.html?dom=shadow',
6363
'unit/styling-cross-scope-unknown-host.html',
6464
'unit/custom-style.html',
65+
'unit/custom-style.html?dom=shadow',
6566
'unit/custom-style-late.html',
6667
'unit/dynamic-import.html',
6768
'unit/templatizer.html',

0 commit comments

Comments
 (0)