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 #238 from sjmiles/master
Browse files Browse the repository at this point in the history
call renderAllPending() in getComputedStyle() override + test; fixes #237
  • Loading branch information
arv committed Sep 5, 2013
2 parents 8f21896 + 068e986 commit 52b9a34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/wrappers/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var unwrap = scope.unwrap;
var unwrapIfNeeded = scope.unwrapIfNeeded;
var wrap = scope.wrap;
var renderAllPending = scope.renderAllPending;

var OriginalWindow = window.Window;

Expand All @@ -21,6 +22,7 @@

var originalGetComputedStyle = window.getComputedStyle;
OriginalWindow.prototype.getComputedStyle = function(el, pseudo) {
renderAllPending();
return originalGetComputedStyle.call(this || window, unwrapIfNeeded(el),
pseudo);
};
Expand Down
11 changes: 11 additions & 0 deletions test/js/Window.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,15 @@ suite('Window', function() {
assert.isTrue(cs != null);
});

test('getComputedStyleShadow', function() {
var host = document.createElement('div');
var root = host.createShadowRoot();
var elt = document.createElement('div');
root.appendChild(elt);
document.body.appendChild(host);
elt.style.padding = '4px';
assert.equal(getComputedStyle(elt).paddingLeft, '4px');
document.body.removeChild(host);
});

});

0 comments on commit 52b9a34

Please sign in to comment.