Fix Polymer.dom(el).attachShadow/shadowRoot

This commit is contained in:
Steven Orvell 2021-07-09 18:05:09 -07:00
parent 56756240fa
commit 2b0494a9c4
2 changed files with 9 additions and 2 deletions

View File

@ -441,7 +441,7 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP
forwardMethods(DomApiNative.prototype, [
'cloneNode', 'appendChild', 'insertBefore', 'removeChild',
'replaceChild', 'setAttribute', 'removeAttribute',
'querySelector', 'querySelectorAll'
'querySelector', 'querySelectorAll', 'attachShadow'
]);
// Properties that should return the logical, not composed tree. Note, `classList`
@ -451,7 +451,7 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP
'parentNode', 'firstChild', 'lastChild',
'nextSibling', 'previousSibling', 'firstElementChild',
'lastElementChild', 'nextElementSibling', 'previousElementSibling',
'childNodes', 'children', 'classList'
'childNodes', 'children', 'classList', 'shadowRoot'
]);
forwardProperties(DomApiNative.prototype, [

View File

@ -415,6 +415,7 @@ suite('forwarded native api', function() {
assert.isDefined(d.classList);
assert.isDefined(d.textContent);
assert.isDefined(d.innerHTML);
assert.isDefined(d.shadowRoot);
});
test('cloneNode', function() {
@ -484,6 +485,12 @@ suite('forwarded native api', function() {
assert.equal(query.length, 2);
});
test('attachShadow', function() {
const el = document.createElement('div');
dom(el).attachShadow({mode: 'open'});
assert.isDefined(el.shadowRoot);
});
test('tree accessors', function() {
const d1 = document.createElement('div');
const d2 = document.createElement('div');