-
Notifications
You must be signed in to change notification settings - Fork 9.6k
core(report): show nodeLabel for DOM nodes in addition to snippet #8961
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
Changes from 1 commit
9a52573
7c5a98b
197d907
0af87da
42712bb
51cc42a
a97aba9
060d2e9
2e50172
0bec94e
8bba61f
fc4f272
37e3e11
eab63fc
6fdeac2
eb3406c
c9094c4
7880109
6993160
533ad17
1d11422
97fdad4
5fbdf5d
f893550
8e64be0
ea1621d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -224,20 +224,19 @@ function getNodeSelector(node) { | |
| */ | ||
| /* istanbul ignore next */ | ||
| function getNodeTitle(node) { | ||
| if (node.tagName === 'HTML' || node.tagName === 'BODY') { | ||
| // too broad, contains all page content | ||
| return null; | ||
| } | ||
| const title = node.innerText || node.getAttribute('alt') || node.getAttribute('aria-label'); | ||
| if (title) { | ||
| return truncate(title, 80); | ||
| } else { | ||
| const nodeToUseForTitle = node.querySelector('[alt], [aria-label]'); | ||
| if (nodeToUseForTitle) { | ||
| return getNodeTitle(/** @type {HTMLElement} */ (nodeToUseForTitle)); | ||
| const tagName = node.tagName.toLowerCase(); | ||
| if (tagName !== 'html' && tagName !== 'body') { | ||
| const title = node.innerText || node.getAttribute('alt') || node.getAttribute('aria-label'); | ||
|
||
| if (title) { | ||
| return truncate(title, 80); | ||
| } else { | ||
| const nodeToUseForTitle = node.querySelector('[alt], [aria-label]'); | ||
|
||
| if (nodeToUseForTitle) { | ||
| return getNodeTitle(/** @type {HTMLElement} */ (nodeToUseForTitle)); | ||
| } | ||
| } | ||
| } | ||
mattzeunert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return null; | ||
| return tagName; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
can you add back that comment about why we skip html and body