diff --git a/lighthouse-cli/test/fixtures/dobetterweb/domtester.html b/lighthouse-cli/test/fixtures/dobetterweb/domtester.html
deleted file mode 100644
index dbbf2694e0d4..000000000000
--- a/lighthouse-cli/test/fixtures/dobetterweb/domtester.html
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
- , returns 'div#myid.myclass'.
@@ -118,10 +129,12 @@ function getDOMStats(element, deep=true) {
depth: {
max: result.maxDepth,
pathToElement: elementPathInDOM(deepestNode),
+ snippet: getOuterHTMLSnippet(deepestNode),
},
width: {
max: result.maxWidth,
pathToElement: elementPathInDOM(parentWithMostChildren),
+ snippet: getOuterHTMLSnippet(parentWithMostChildren),
},
};
}
@@ -133,6 +146,7 @@ class DOMStats extends Gatherer {
*/
afterPass(options) {
const expression = `(function() {
+ ${getOuterHTMLSnippet.toString()};
${createSelectorsLabel.toString()};
${elementPathInDOM.toString()};
return (${getDOMStats.toString()}(document.documentElement));
diff --git a/lighthouse-core/report/v2/renderer/details-renderer.js b/lighthouse-core/report/v2/renderer/details-renderer.js
index bbc714102136..98a476191346 100644
--- a/lighthouse-core/report/v2/renderer/details-renderer.js
+++ b/lighthouse-core/report/v2/renderer/details-renderer.js
@@ -46,8 +46,6 @@ class DetailsRenderer {
return this._renderThumbnail(/** @type {!DetailsRenderer.ThumbnailDetails} */ (details));
case 'filmstrip':
return this._renderFilmstrip(/** @type {!DetailsRenderer.FilmstripDetails} */ (details));
- case 'cards':
- return this._renderCards(/** @type {!DetailsRenderer.CardsDetailsJSON} */ (details));
case 'table':
return this._renderTable(/** @type {!DetailsRenderer.TableDetailsJSON} */ (details));
case 'code':
@@ -57,8 +55,6 @@ class DetailsRenderer {
case 'criticalrequestchain':
return CriticalRequestChainRenderer.render(this._dom, this._templateContext,
/** @type {!CriticalRequestChainRenderer.CRCDetailsJSON} */ (details));
- case 'list':
- return this._renderList(/** @type {!DetailsRenderer.ListDetailsJSON} */ (details));
default: {
throw new Error(`Unknown type: ${details.type}`);
}
@@ -177,24 +173,6 @@ class DetailsRenderer {
return element;
}
- /**
- * @param {!DetailsRenderer.ListDetailsJSON} list
- * @return {!Element}
- */
- _renderList(list) {
- if (!list.items.length) return this._dom.createElement('span');
-
- const element = this._dom.createElement('details', 'lh-details');
- element.open = true;
-
- const itemsElem = this._dom.createChildOf(element, 'div', 'lh-list__items');
- for (const item of list.items) {
- const itemElem = this._dom.createChildOf(itemsElem, 'span', 'lh-list__item');
- itemElem.appendChild(this.render(item));
- }
- return element;
- }
-
/**
* @param {!DetailsRenderer.TableDetailsJSON} details
* @return {!Element}
@@ -266,37 +244,6 @@ class DetailsRenderer {
return element;
}
- /**
- * @param {!DetailsRenderer.CardsDetailsJSON} details
- * @return {!Element}
- */
- _renderCards(details) {
- const element = this._dom.createElement('details', 'lh-details');
- element.open = true;
- if (details.header) {
- element.appendChild(this._dom.createElement('summary')).textContent = details.header.text;
- }
-
- const cardsParent = this._dom.createElement('div', 'lh-scorecards');
- for (const item of details.items) {
- const card = cardsParent.appendChild(
- this._dom.createElement('div', 'lh-scorecard', {title: item.snippet}));
- const titleEl = this._dom.createElement('div', 'lh-scorecard__title');
- const valueEl = this._dom.createElement('div', 'lh-scorecard__value');
- const targetEl = this._dom.createElement('div', 'lh-scorecard__target');
-
- card.appendChild(titleEl).textContent = item.title;
- card.appendChild(valueEl).textContent = item.value;
-
- if (item.target) {
- card.appendChild(targetEl).textContent = `target: ${item.target}`;
- }
- }
-
- element.appendChild(cardsParent);
- return element;
- }
-
/**
* @param {!DetailsRenderer.FilmstripDetails} details
* @return {!Element}
@@ -354,16 +301,6 @@ if (typeof module !== 'undefined' && module.exports) {
*/
DetailsRenderer.DetailsJSON; // eslint-disable-line no-unused-expressions
-/**
- * @typedef {{
- * type: string,
- * header: ({text: string}|undefined),
- * items: !Array
- * }}
- */
-DetailsRenderer.ListDetailsJSON; // eslint-disable-line no-unused-expressions
-
-
/**
* @typedef {{
* type: string,
@@ -395,14 +332,6 @@ DetailsRenderer.NumericUnitDetailsJSON; // eslint-disable-line no-unused-express
*/
DetailsRenderer.NodeDetailsJSON; // eslint-disable-line no-unused-expressions
-/** @typedef {{
- * type: string,
- * header: ({text: string}|undefined),
- * items: !Array<{title: string, value: string, snippet: (string|undefined), target: string}>
- * }}
- */
-DetailsRenderer.CardsDetailsJSON; // eslint-disable-line no-unused-expressions
-
/**
* @typedef {{
* itemType: string,
diff --git a/lighthouse-core/report/v2/report-styles.css b/lighthouse-core/report/v2/report-styles.css
index bdb85b941fc6..cde7b628d4a0 100644
--- a/lighthouse-core/report/v2/report-styles.css
+++ b/lighthouse-core/report/v2/report-styles.css
@@ -167,20 +167,6 @@ summary {
background-image: url('data:image/svg+xml;utf8,
');
}
-/* List */
-.lh-list {
- font-size: smaller;
- margin-top: var(--default-padding);
-}
-
-.lh-list__items {
- padding-left: var(--default-padding);
-}
-
-.lh-list__item {
- margin-bottom: 2px;
-}
-
/* Node */
.lh-node {
display: block;
@@ -193,43 +179,6 @@ span.lh-node:hover {
border-radius: 2px;
}
-/* Card */
-.lh-scorecards {
- display: flex;
- flex-wrap: wrap;
-}
-.lh-scorecard {
- display: flex;
- align-items: center;
- justify-content: center;
- flex: 0 0 calc(12 * var(--body-font-size));
- flex-direction: column;
- padding: var(--default-padding);
- padding-top: calc(32px + var(--default-padding));
- border-radius: 3px;
- margin-right: var(--default-padding);
- position: relative;
- line-height: inherit;
- border: 1px solid #ebebeb;
-}
-.lh-scorecard__title {
- background-color: #eee;
- position: absolute;
- top: 0;
- right: 0;
- left: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- padding: calc(var(--default-padding) / 2);
-}
-.lh-scorecard__value {
- font-size: calc(1.6 * var(--body-font-size));
-}
-.lh-scorecard__target {
- margin-top: calc(var(--default-padding) / 2);
-}
-
/* Score */
.lh-score {
diff --git a/lighthouse-core/test/audits/dobetterweb/dom-size-test.js b/lighthouse-core/test/audits/dobetterweb/dom-size-test.js
index bc7e4b2c0a2c..a0eb9572c889 100644
--- a/lighthouse-core/test/audits/dobetterweb/dom-size-test.js
+++ b/lighthouse-core/test/audits/dobetterweb/dom-size-test.js
@@ -20,23 +20,14 @@ describe('Num DOM nodes audit', () => {
},
};
- const snippet = 'html >\n' +
- ' body >\n' +
- ' div >\n' +
- ' span';
-
it('calculates score hitting top of distribution', () => {
const auditResult = DOMSize.audit(artifact);
assert.equal(auditResult.score, 1);
assert.equal(auditResult.rawValue, numNodes);
assert.equal(auditResult.displayValue, `${numNodes.toLocaleString()} nodes`);
- assert.equal(auditResult.details.items[0].title, 'Total DOM Nodes');
- assert.equal(auditResult.details.items[0].value, numNodes.toLocaleString());
- assert.equal(auditResult.details.items[1].title, 'DOM Depth');
- assert.equal(auditResult.details.items[1].value, 1);
- assert.equal(auditResult.details.items[1].snippet, snippet, 'generates snippet');
- assert.equal(auditResult.details.items[2].title, 'Maximum Children');
- assert.equal(auditResult.details.items[2].value, 2);
+ assert.equal(auditResult.details.items[0].totalNodes, numNodes.toLocaleString());
+ assert.equal(auditResult.details.items[0].depth, '1');
+ assert.equal(auditResult.details.items[0].width, '2');
});
it('calculates score hitting mid distribution', () => {
diff --git a/lighthouse-core/test/report/v2/renderer/details-renderer-test.js b/lighthouse-core/test/report/v2/renderer/details-renderer-test.js
index 732127cd5bbe..167b266cc2de 100644
--- a/lighthouse-core/test/report/v2/renderer/details-renderer-test.js
+++ b/lighthouse-core/test/report/v2/renderer/details-renderer-test.js
@@ -40,49 +40,6 @@ describe('DetailsRenderer', () => {
assert.ok(el.classList.contains('lh-text'), 'adds classes');
});
- it('renders lists without headers', () => {
- const el = renderer.render({
- type: 'list',
- items: [
- {type: 'text', value: 'content 1'},
- {type: 'text', value: 'content 2'},
- {type: 'text', value: 'content 3'},
- ],
- });
-
- const header = el.querySelector('.lh-list__header');
- assert.ok(!header, 'rendered header');
-
- const items = el.querySelector('.lh-list__items');
- assert.equal(items.children.length, 3, 'did not render children');
- });
-
- it('renders cards', () => {
- const list = {
- header: {type: 'text', value: 'View details'},
- items: [
- {title: 'Total DOM Nodes', value: 3500, target: '1,500 nodes'},
- {title: 'DOM Depth', value: 10, snippet: 'snippet'},
- {title: 'Maximum Children', value: 20, snippet: 'snippet2', target: 20},
- ],
- };
-
- const details = renderer._renderCards(list);
-
- const cards = details.querySelectorAll('.lh-scorecards > .lh-scorecard');
- assert.ok(cards.length, list.items.length, `renders ${list.items.length} cards`);
- assert.equal(cards[0].hasAttribute('title'), false,
- 'does not add title attr if snippet is missing');
- assert.equal(cards[0].querySelector('.lh-scorecard__title').textContent,
- 'Total DOM Nodes', 'fills title');
- assert.equal(cards[0].querySelector('.lh-scorecard__value').textContent,
- '3500', 'fills value');
- assert.equal(cards[0].querySelector('.lh-scorecard__target').textContent,
- 'target: 1,500 nodes', 'fills target');
- assert.equal(cards[1].getAttribute('title'), 'snippet', 'adds title attribute for snippet');
- assert.ok(!cards[1].querySelector('.lh-scorecard__target'), 'handles missing target');
- });
-
it('renders code', () => {
const el = renderer.render({
type: 'code',
diff --git a/lighthouse-core/test/results/sample_v2.json b/lighthouse-core/test/results/sample_v2.json
index 65124d657ac0..e9268ecb279b 100644
--- a/lighthouse-core/test/results/sample_v2.json
+++ b/lighthouse-core/test/results/sample_v2.json
@@ -23,15 +23,17 @@
"description": "Does not use HTTPS",
"helpText": "All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/https).",
"details": {
- "type": "list",
- "header": {
- "type": "text",
- "text": "Insecure URLs:"
- },
+ "type": "table",
+ "headings": [
+ {
+ "key": "url",
+ "itemType": "url",
+ "text": "Insecure URL"
+ }
+ ],
"items": [
{
- "type": "url",
- "value": "http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"
+ "url": "http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"
}
]
}
@@ -1746,11 +1748,8 @@
"description": "The page contains a heading, skip link, or landmark region",
"helpText": "Adding ways to bypass repetitive content lets keyboard users navigate the page more efficiently. [Learn more](https://dequeuniversity.com/rules/axe/2.2/bypass?application=lighthouse).",
"details": {
- "type": "list",
- "header": {
- "type": "text",
- "text": "View failing elements"
- },
+ "type": "table",
+ "headings": [],
"items": []
}
},
@@ -1799,23 +1798,30 @@
"description": "Background and foreground colors do not have a sufficient contrast ratio.",
"helpText": "Low-contrast text is difficult or impossible for many users to read. [Learn more](https://dequeuniversity.com/rules/axe/2.2/color-contrast?application=lighthouse).",
"details": {
- "type": "list",
- "header": {
- "type": "text",
- "text": "View failing elements"
- },
+ "type": "table",
+ "headings": [
+ {
+ "key": "node",
+ "itemType": "node",
+ "text": "Failing Elements"
+ }
+ ],
"items": [
{
- "type": "node",
- "selector": "div > h2",
- "path": "3,HTML,1,BODY,0,DIV,0,H2",
- "snippet": "