Skip to content

Commit

Permalink
report(xbrowser): replace Typed OM getComputedStyle() with CSSOM equi…
Browse files Browse the repository at this point in the history
…valent (#5984)
  • Loading branch information
midzer authored and paulirish committed Sep 8, 2018
1 parent 81725ac commit 942cc02
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lighthouse-core/report/html/renderer/report-ui-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,17 @@ class ReportUIFeatures {

_setupHeaderAnimation() {
const scoresWrapper = this._dom.find('.lh-scores-wrapper', this._document);
this.headerOverlap = /** @type {number} */
// @ts-ignore - TODO: move off CSSOM to support other browsers
(scoresWrapper.computedStyleMap().get('margin-top').value);

const computedMarginTop = window.getComputedStyle(scoresWrapper).marginTop;
this.headerOverlap = parseFloat(computedMarginTop || '0');
this.headerSticky = this._dom.find('.lh-header-sticky', this._document);
this.headerBackground = this._dom.find('.lh-header-bg', this._document);
this.lighthouseIcon = this._dom.find('.lh-lighthouse', this._document);
this.scoresWrapperBg = this._dom.find('.lh-scores-wrapper__background', this._document);
this.productInfo = this._dom.find('.lh-product-info', this._document);
this.toolbar = this._dom.find('.lh-toolbar', this._document);
this.toolbarMetadata = this._dom.find('.lh-toolbar__metadata', this._document);

// @ts-ignore - TODO: move off CSSOM to support other browsers
this.headerHeight = this.headerBackground.computedStyleMap().get('height').value;
const computedHeight = window.getComputedStyle(this.headerBackground).height;
this.headerHeight = parseFloat(computedHeight || '0');

this._document.addEventListener('scroll', this.onScroll, {passive: true});

Expand Down

0 comments on commit 942cc02

Please sign in to comment.