Skip to content

Commit

Permalink
fix Shouldn't process shadow ui elements (close #1570)
Browse files Browse the repository at this point in the history
  • Loading branch information
LavrovArtem committed Apr 16, 2018
1 parent a301dcd commit bcebd87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/sandbox/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class NodeSandbox extends SandboxBase {
_processElement (el) {
const processedContext = el[INTERNAL_PROPS.processedContext];

if (processedContext !== this.window) {
if (!domUtils.isShadowUIElement(el) && processedContext !== this.window) {
let urlAttrName = null;

if (processedContext) {
Expand Down
10 changes: 10 additions & 0 deletions test/client/fixtures/sandbox/shadow-ui-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var SHADOW_UI_CLASSNAME = hammerhead.get('./../shadow-ui/class-name');
var ShadowUI = hammerhead.get('./sandbox/shadow-ui');
var INTERNAL_PROPS = hammerhead.get('../processing/dom/internal-properties');

var shadowUI = hammerhead.sandbox.shadowUI;
var domUtils = hammerhead.utils.dom;
Expand Down Expand Up @@ -838,4 +839,13 @@ test('processed nodeList should have non-enumerable "item" and "namedItem" prope
strictEqual(collectionKeys.indexOf('item'), -1, 'item');
strictEqual(collectionKeys.indexOf('namedItem'), -1, 'namedItem');
strictEqual(collectionKeys.indexOf('length'), -1, 'length');

document.body.removeChild(div);
});

test('should not process shadow ui elements (GH-1570)', function () {
var shadowUIElements = hammerhead.nativeMethods.querySelectorAll.call(document, '[class$="-hammerhead-shadow-ui"]');

for (var i = 0; i < shadowUIElements.length; i++)
ok(!shadowUIElements[i][INTERNAL_PROPS.processedContext]);
});

0 comments on commit bcebd87

Please sign in to comment.