Use local references to wrapper functions; add test element tree to native shadow tests; reorder test elements.

This commit is contained in:
Russell Bicknell 2016-01-08 14:11:25 -08:00
parent e848af8964
commit 47ee2ca912
4 changed files with 147 additions and 140 deletions

View File

@ -60,8 +60,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
activeElement: {
get: function() {
var node = Polymer.DomApi.wrap(this.node);
var node = DomApi.wrap(this.node);
var activeElement = node.activeElement;
// Prevents `activeElement` from returning elements outside of the
// ShadowRoot, even if they would become descendants of the ShadowRoot
// in the composed tree. See w3c/webcomponents#358.
return node.contains(activeElement) ? activeElement : null;
},
configurable: true

View File

@ -446,10 +446,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// This node is either the document or a shady root of which the active
// element is a (composed) descendant of its host; iterate upwards to
// find the active element's most shallow host within it.
var activeRoot = Polymer.dom(active).getOwnerRoot();
var activeRoot = dom(active).getOwnerRoot();
while (activeRoot && activeRoot !== this.node) {
active = activeRoot.host;
activeRoot = Polymer.dom(active).getOwnerRoot();
activeRoot = dom(active).getOwnerRoot();
}
if (this.node === document) {
// This node is the document, so activeRoot should be null.

View File

@ -359,25 +359,13 @@
</dom-module>
<dom-module id="x-shadow-host-root">
<dom-module id="x-shadow-host-root-0-0">
<template>
<content></content>
<div>
<div>
<x-shadow-host-root-0>
<x-shadow-host-root-0-light></x-shadow-host-root-0-light>
</x-shadow-host-root-0>
</div>
</div>
<div>
<x-shadow-host-root-1>
<x-shadow-host-root-1-light></x-shadow-host-root-1-light>
</x-shadow-host-root-1>
</div>
</template>
<script>
Polymer({
is: 'x-shadow-host-root',
is: 'x-shadow-host-root-0-0',
hostAttributes: {
tabindex: '-1'
}
@ -385,10 +373,53 @@
</script>
</dom-module>
<dom-module id="x-shadow-host-root-light">
<dom-module id="x-shadow-host-root-0-0-light-0">
<script>
Polymer({
is: 'x-shadow-host-root-light',
is: 'x-shadow-host-root-0-0-light-0',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-0-light">
<template>
<div>
<div>
<x-shadow-host-root-0-0-light-0></x-shadow-host-root-0-0-light-0>
</div>
</div>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-0-0-light',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-1">
<template>
<content></content>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-0-1',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-1-light">
<script>
Polymer({
is: 'x-shadow-host-root-0-1-light',
hostAttributes: {
tabindex: '-1'
}
@ -429,127 +460,6 @@
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-0">
<template>
<content></content>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-0-0',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-0-light">
<template>
<div>
<div>
<x-shadow-host-root-0-0-light-0></x-shadow-host-root-0-0-light-0>
</div>
</div>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-0-0-light',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-0-light-0">
<script>
Polymer({
is: 'x-shadow-host-root-0-0-light-0',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-1">
<template>
<content></content>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-0-1',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-0-1-light">
<script>
Polymer({
is: 'x-shadow-host-root-0-1-light',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-1">
<template>
<content></content>
<div>
<x-shadow-host-root-1-0>
<x-shadow-host-root-1-0-light></x-shadow-host-root-1-0-light>
</x-shadow-host-root-1-0>
</div>
<div>
<div>
<div>
<x-shadow-host-root-1-1>
<x-shadow-host-root-1-1-light></x-shadow-host-root-1-1-light>
</x-shadow-host-root-1-1>
</div>
</div>
</div>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-1',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-1-light">
<template>
<x-shadow-host-root-1-light-0></x-shadow-host-root-1-light-0>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-1-light',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-1-light-0">
<script>
Polymer({
is: 'x-shadow-host-root-1-light-0',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-1-0">
<template>
<content></content>
@ -599,3 +509,93 @@
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-1">
<template>
<content></content>
<div>
<x-shadow-host-root-1-0>
<x-shadow-host-root-1-0-light></x-shadow-host-root-1-0-light>
</x-shadow-host-root-1-0>
</div>
<div>
<div>
<div>
<x-shadow-host-root-1-1>
<x-shadow-host-root-1-1-light></x-shadow-host-root-1-1-light>
</x-shadow-host-root-1-1>
</div>
</div>
</div>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-1',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-1-light-0">
<script>
Polymer({
is: 'x-shadow-host-root-1-light-0',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-1-light">
<template>
<x-shadow-host-root-1-light-0></x-shadow-host-root-1-light-0>
</template>
<script>
Polymer({
is: 'x-shadow-host-root-1-light',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root">
<template>
<content></content>
<div>
<div>
<x-shadow-host-root-0>
<x-shadow-host-root-0-light></x-shadow-host-root-0-light>
</x-shadow-host-root-0>
</div>
</div>
<div>
<x-shadow-host-root-1>
<x-shadow-host-root-1-light></x-shadow-host-root-1-light>
</x-shadow-host-root-1>
</div>
</template>
<script>
Polymer({
is: 'x-shadow-host-root',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>
<dom-module id="x-shadow-host-root-light">
<script>
Polymer({
is: 'x-shadow-host-root-light',
hostAttributes: {
tabindex: '-1'
}
});
</script>
</dom-module>

View File

@ -56,6 +56,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<x-wrapped></x-wrapped>
<x-shadow-host-root>
<x-shadow-host-root-light></x-shadow-host-root-light>
</x-shadow-host-root>
<script src="polymer-dom.js"></script>
</body>