-
Notifications
You must be signed in to change notification settings - Fork 9.6k
report: make urls clickable #9224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
aa94dee
report: make urls clickable
connorjclark 5ebc419
request chain
connorjclark 64a7cf0
fix tests
connorjclark 4bd8a9e
noopener
connorjclark 12f4728
renderLink
connorjclark d6eae56
rename
connorjclark fbc179f
fix types
connorjclark 6c43e7e
remove lh-link
connorjclark 858b63a
noopener
connorjclark ebeda1b
renderlink args
connorjclark a032633
Update lighthouse-core/report/html/renderer/details-renderer.js
connorjclark a000cb4
fix test
connorjclark 425d7ec
fix test
connorjclark 7d93bde
report: allow CRC to use renderTextUrl (#9237)
paulirish 4707e95
Merge remote-tracking branch 'origin/master' into report-url-anchors
connorjclark c7504ab
detailsRenderer
connorjclark b965f04
fix test
connorjclark ccefdd4
test
connorjclark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
report: make urls clickable
- Loading branch information
commit aa94dee2cc754a84a555a731e2e40832ab7be1be
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,7 +113,7 @@ class DetailsRenderer { | |
| } | ||
|
|
||
| const element = this._dom.createElement('div', 'lh-text__url'); | ||
| element.appendChild(this._renderText(displayedPath)); | ||
| element.appendChild(this._renderAnchor(displayedPath, url)); | ||
|
|
||
| if (displayedHost) { | ||
| const hostElem = this._renderText(displayedHost); | ||
|
|
@@ -160,6 +160,19 @@ class DetailsRenderer { | |
| return element; | ||
| } | ||
|
|
||
| /** | ||
| * @param {string} text | ||
| * @param {string} href | ||
| * @return {Element} | ||
| */ | ||
| _renderAnchor(text, href) { | ||
| const element = this._dom.createElement('a', 'lh-anchor'); | ||
| element.textContent = text; | ||
| element.href = href; | ||
| element.target = '_blank'; | ||
|
||
| return element; | ||
| } | ||
|
|
||
| /** | ||
| * @param {string} text | ||
| * @return {Element} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we should rename this method now ;)
maybe we can also share some logic with
renderLinkat this point since I was about to make_renderAnchorcomments about falling back to text on invalid, etcThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, didn't see that method. done.