Skip to content

Commit

Permalink
feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jan 9, 2018
1 parent c60977c commit c54014a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions lighthouse-core/report/v2/renderer/details-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DetailsRenderer {
const url = text.text || '';

let displayedPath;
let displayedHost = '';
let displayedHost;
let title;
try {
const parsed = Util.parseURL(url);
Expand All @@ -85,16 +85,16 @@ class DetailsRenderer {
element.appendChild(this._renderText({
text: displayedPath,
}));
const hostElem = this._renderText({
text: displayedHost,
});
hostElem.classList.add('lh-text__url-host');
element.appendChild(hostElem);

if (title) {
element.title = url;

if (displayedHost) {
const hostElem = this._renderText({
text: displayedHost,
});
hostElem.classList.add('lh-text__url-host');
element.appendChild(hostElem);
}

if (title) element.title = url;
return element;
}

Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/report/v2/renderer/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ class Util {
}

const MAX_LENGTH = 64;
// Always elide git hash
// Always elide hexadecimal hash
name = name.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, `$1${ELLIPSIS}`);
// Also elide other hash-like mixed-case strings // lol this is crazy
// Also elide other hash-like mixed-case strings
name = name.replace(/([a-zA-Z0-9-_]{9})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9-_]{10,}/g,
`$1${ELLIPSIS}`);
// Also elide long number sequences
name = name.replace(/(\d{3})\d{6,}/g, `$1${ELLIPSIS}`);
// Merge any adjacent ellipses
name = name.replace(/\u2026+/g, '\u2026');
name = name.replace(/\u2026+/g, ELLIPSIS);

// Elide query params first
if (name.length > MAX_LENGTH && name.includes('?')) {
Expand Down

0 comments on commit c54014a

Please sign in to comment.