Skip to content

Commit

Permalink
feat: expose id attribute in ScriptElements
Browse files Browse the repository at this point in the history
  • Loading branch information
umair-choudhary committed Sep 23, 2019
1 parent 52cb0c9 commit 2c4283f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 23 deletions.
2 changes: 2 additions & 0 deletions lighthouse-core/gather/gatherers/script-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function collectAllScriptElements() {
return {
type: script.type || null,
src: script.src || null,
id: script.id || null,
async: script.async,
defer: script.defer,
source: /** @type {'head'|'body'} */ (script.closest('head') ? 'head' : 'body'),
Expand Down Expand Up @@ -81,6 +82,7 @@ class ScriptElements extends Gatherer {
devtoolsNodePath: '',
type: null,
src: record.url,
id: null,
async: false,
defer: false,
source: 'network',
Expand Down
89 changes: 66 additions & 23 deletions lighthouse-core/test/results/artifacts/artifacts.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions types/artifacts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ declare global {
export interface ScriptElement {
type: string | null
src: string | null
/** The id uniquely identifies a script element, null if script source is network */
id: string | null
async: boolean
defer: boolean
/** Path that uniquely identifies the node in the DOM */
Expand Down

0 comments on commit 2c4283f

Please sign in to comment.