Skip to content

Commit

Permalink
fix closure
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed May 4, 2017
1 parent 9a3e79f commit 103fe62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
27 changes: 6 additions & 21 deletions lighthouse-core/report/v2/renderer/details-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class DetailsRenderer {
return this._renderURL(details);
case 'thumbnail':
return this._renderThumbnail(details);
case 'block':
return this._renderBlock(details);
case 'cards':
return this._renderCards(/** @type {!DetailsRenderer.CardsDetailsJSON} */ (details));
case 'table':
Expand Down Expand Up @@ -72,12 +70,12 @@ class DetailsRenderer {
}

/**
* @param {!DetailsRenderer.ThumbnailDetails} obj
* @return {!DocumentFragment}
* @param {!DetailsRenderer.ThumbnailDetails} value
* @return {!Element}
*/
_renderThumbnail(value) {
if (/^image/.test(value.mimeType) === false) {
return this.dom.createDocumentFragment();
return this._dom.createElement('span');
}

const element = this._dom.createElement('img', 'lh-thumbnail');
Expand All @@ -87,19 +85,6 @@ class DetailsRenderer {
return element;
}

/**
* @param {!DetailsRenderer.DetailsJSON} block
* @return {!Element}
*/
_renderBlock(block) {
const element = this._dom.createElement('div', 'lh-block');
const items = block.items || [];
for (const item of items) {
element.appendChild(this.render(item));
}
return element;
}

/**
* @param {!DetailsRenderer.ListDetailsJSON} list
* @return {!Element}
Expand All @@ -123,10 +108,10 @@ class DetailsRenderer {

/**
* @param {!DetailsRenderer.TableDetailsJSON} details
* @return {!DocumentFragment}
* @return {!Element}
*/
_renderTable(details) {
if (!details.items.length) return this._dom.createDocumentFragment();
if (!details.items.length) return this._dom.createElement('span');

const element = this._dom.createElement('details', 'lh-details');
if (details.header) {
Expand Down Expand Up @@ -216,7 +201,7 @@ DetailsRenderer.CardsDetailsJSON; // eslint-disable-line no-unused-expressions
/** @typedef {{
* type: string,
* header: ({text: string}|undefined),
* items: !Array<!DetailsRenderer.DetailsJSON>,
* items: !Array<!Array<!DetailsRenderer.DetailsJSON>>,
* itemHeaders: !Array<!DetailsRenderer.DetailsJSON>
* }}
*/
Expand Down
7 changes: 0 additions & 7 deletions lighthouse-core/report/v2/renderer/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ class DOM {
return element;
}

/**
* @return {!DocumentFragment}
*/
createDocumentFragment() {
return this._document.createDocumentFragment();
}

/**
* @param {string} selector
* @param {!Node} context
Expand Down

0 comments on commit 103fe62

Please sign in to comment.