Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #461 from arv/lost-projection
Browse files Browse the repository at this point in the history
Fix issue with invalidation
  • Loading branch information
Steve Orvell committed Jun 26, 2014
2 parents 527721a + ae6fcb4 commit bfc202e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ShadowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@
invalidate: function() {
if (!this.dirty) {
this.dirty = true;
var parentRenderer = this.parentRenderer;
if (parentRenderer)
parentRenderer.invalidate();
pendingDirtyRenderers.push(this);
if (renderTimer)
return;
Expand Down
39 changes: 39 additions & 0 deletions test/js/reprojection.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,43 @@ suite('Shadow DOM reprojection', function() {

assert.equal(getVisualInnerHtml(xFoo), '<x-zot><div>Hello</div></x-zot>');
});

test('Issue 460', function() {
// div
// - shadow-root
// -- a
// --- b
// ---- shadow-root
// ----- content
// ---- content (content2)
// - d

var div = document.createElement('div');
var sr = div.createShadowRoot();
var a = sr.appendChild(document.createElement('a'));
var b = a.appendChild(document.createElement('b'));
var sr2 = b.createShadowRoot();
var content = sr2.appendChild(document.createElement('content'));
var content2 = b.appendChild(document.createElement('content'));
var d = div.appendChild(document.createElement('d'));

assert.equal(getVisualInnerHtml(div), '<a><b><d></d></b></a>');

var sr3 = a.createShadowRoot();
assert.equal(getVisualInnerHtml(div), '<a></a>');

// div
// - shadow-root
// -- a
// --- shadow-root (sr3)
// ---- content (content3)
// --- b
// ---- shadow-root
// ----- content
// ---- content (content2)
// - d

var content3 = sr3.appendChild(document.createElement('content'));
assert.equal(getVisualInnerHtml(div), '<a><b><d></d></b></a>');
});
});

0 comments on commit bfc202e

Please sign in to comment.