mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3269 from Polymer/shadow-test-tweaks
Shadow test tweaks
This commit is contained in:
commit
4610007799
@ -26,28 +26,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
return TreeApi.arrayCopy(this.node.querySelectorAll(selector));
|
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() {
|
getOwnerRoot: function() {
|
||||||
var n = this.node;
|
var n = this.node;
|
||||||
while (n) {
|
while (n) {
|
||||||
|
@ -354,28 +354,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
}, this.node);
|
}, this.node);
|
||||||
},
|
},
|
||||||
|
|
||||||
_query: function(matcher, node) {
|
|
||||||
node = node || this.node;
|
|
||||||
var list = [];
|
|
||||||
this._queryElements(TreeApi.Logical.getChildNodes(node), 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(TreeApi.Logical.getChildNodes(node), matcher, list);
|
|
||||||
},
|
|
||||||
|
|
||||||
getDestinationInsertionPoints: function() {
|
getDestinationInsertionPoints: function() {
|
||||||
return this.node._destinationInsertionPoints || [];
|
return this.node._destinationInsertionPoints || [];
|
||||||
},
|
},
|
||||||
|
@ -21,6 +21,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Settings = Polymer.Settings;
|
var Settings = Polymer.Settings;
|
||||||
|
var TreeApi = Polymer.TreeApi;
|
||||||
|
|
||||||
var DomApi = function(node) {
|
var DomApi = function(node) {
|
||||||
this.node = needsToWrap ? DomApi.wrap(node) : node;
|
this.node = needsToWrap ? DomApi.wrap(node) : node;
|
||||||
@ -134,6 +135,31 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
if (this.observer) {
|
if (this.observer) {
|
||||||
this.observer.notify();
|
this.observer.notify();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// NOTE: `_query` is used primarily for ShadyDOM's querySelector impl,
|
||||||
|
// but it's also generally useful to recurse through the element tree
|
||||||
|
// and is used by Polymer's styling system.
|
||||||
|
_query: function(matcher, node) {
|
||||||
|
node = node || this.node;
|
||||||
|
var list = [];
|
||||||
|
this._queryElements(TreeApi.Logical.getChildNodes(node), 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(TreeApi.Logical.getChildNodes(node), matcher, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -56,10 +56,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
'unit/styling-remote.html',
|
'unit/styling-remote.html',
|
||||||
'unit/styling-cross-scope-var.html',
|
'unit/styling-cross-scope-var.html',
|
||||||
'unit/styling-cross-scope-apply.html',
|
'unit/styling-cross-scope-apply.html',
|
||||||
// TODO(sorvell): disable until this Chrome bug is addressed:
|
'unit/styling-cross-scope-var.html?dom=shadow',
|
||||||
// https://code.google.com/p/chromium/issues/detail?id=525280
|
'unit/styling-cross-scope-apply.html?dom=shadow',
|
||||||
// 'unit/styling-cross-scope-var.html?dom=shadow',
|
|
||||||
// 'unit/styling-cross-scope-apply.html?dom=shadow',
|
|
||||||
'unit/styling-cross-scope-unknown-host.html',
|
'unit/styling-cross-scope-unknown-host.html',
|
||||||
'unit/custom-style.html',
|
'unit/custom-style.html',
|
||||||
'unit/custom-style.html?dom=shadow',
|
'unit/custom-style.html?dom=shadow',
|
||||||
|
@ -155,7 +155,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
<div class="foo"></div>
|
<div class="foo"></div>
|
||||||
|
|
||||||
<div class="foo--bar style-scope"></div>
|
<div class="foo--bar"></div>
|
||||||
|
|
||||||
<dom-module id="x-baz">
|
<dom-module id="x-baz">
|
||||||
<style>
|
<style>
|
||||||
@ -489,7 +489,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('BEM-like CSS selectors under media queries', function() {
|
test('BEM-like CSS selectors under media queries', function() {
|
||||||
assertComputed(document.querySelector('.foo--bar'), '3px');
|
assertComputed(document.querySelector('.foo--bar'), '20px');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user