Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
flush and explain why
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi committed Apr 13, 2017
1 parent e599dde commit b6f5441
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions iron-fit-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,16 @@
}
this.positionTarget = this.positionTarget || this._defaultPositionTarget;
if (this.autoFitOnAttach) {
// If invisible or in a shadow root that's still not connected, wait a tick.
if (window.getComputedStyle(this).display === 'none' ||
document.body.contains(this) === false) {
if (window.getComputedStyle(this).display === 'none') {
this.__deferredFit = setTimeout(function() {
this.__deferredFit = null;
this.fit();
}.bind(this));
} else {
// NOTE: shadydom won't apply the upgrades synchronously for performance reasons
// but this might lead to wrong layout information webcomponents/shadydom#120
// We flush because we need correct layout bounding rect info.
window.ShadyDOM && ShadyDOM.flush();
this.fit();
}
}
Expand Down

0 comments on commit b6f5441

Please sign in to comment.