Skip to content

Commit

Permalink
Fix Polymer.dom(el).attachShadow/shadowRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed Jul 10, 2021
1 parent 5675624 commit 2b0494a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/legacy/polymer.dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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, [
Expand Down
7 changes: 7 additions & 0 deletions test/unit/polymer-dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@
assert.isDefined(d.classList);
assert.isDefined(d.textContent);
assert.isDefined(d.innerHTML);
assert.isDefined(d.shadowRoot);
});

test('cloneNode', function() {
Expand Down Expand Up @@ -484,6 +485,12 @@
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');
Expand Down

0 comments on commit 2b0494a

Please sign in to comment.