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

call renderAllPending() in getComputedStyle() override + test; fixes #237 #238

Merged
merged 1 commit into from
Sep 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
});

});