-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
report: add details-element polyfill for Edge #6465
Conversation
travis is still unhappy about it being require'd from node during collecting strings, maybe we should have an early exit if it's in node? |
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.
LGTM other than test issue!
} | ||
|
||
}).call(this); | ||
(function() { |
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.
what was this one? :)
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.
@paulirish you still need the details, summary part in the report.
lighthouse/lighthouse-core/report/html/report-styles.css
Lines 128 to 131 in 7150174
/* Edge doesn't recognize these, so we preemptively set to display:block */ | |
details, summary { | |
display: block; | |
} |
If you don't. Edge doesn't threat it as block elements. The polyfill only adds the details > summary { display: block; }
so you still need to add details { display: block; }
to the lighthouse css. Unknown elements are threated as display: inline
Copyright © 2018 Javan Makhmali | ||
*/ | ||
|
||
(function() { |
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 we ditch this empty function?
} | ||
|
||
}).call(this); | ||
(function() { |
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.
Same here?
sg to all. updated. |
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.
You should also try out the "save as html" in viewer (should work fine since it inlines the html-report-assets
into the copy of the generator and uses that to save a new version) and just a regular report (saves outerHTML
, so may be trickier with polyfilled stuff and the polyfill itself copied over?)
@@ -11,6 +11,8 @@ const REPORT_TEMPLATE = fs.readFileSync(__dirname + '/report-template.html', 'ut | |||
const REPORT_JAVASCRIPT = [ | |||
fs.readFileSync(__dirname + '/renderer/util.js', 'utf8'), | |||
fs.readFileSync(__dirname + '/renderer/dom.js', 'utf8'), | |||
// COMPAT: Remove when Microsoft Edge supports <details>/<summary> |
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 link the edge bug?
@@ -0,0 +1,295 @@ | |||
/* |
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.
I know there's a thing with copying the report renderer files around, but is it possible to support this in the top-level third-party/
? It should really be there (it makes it very clear its relationship to lighthouse)
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.
also need a license file in parallel to it, and ideally a readme that says the source commit and lists the modifications made
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.
I'll do these as a followup. It adds too much complexity to the roll right now.
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.
LGTM
(I think the extension error isn't a real one, but should double check it)
Split this out of #6459 as it's more complex then the other fixes. Hope that's cool, @wardpeet !
Edge doesn't support
<details>
but it's high priority for them.Our clients:
DevTools Audits panel: Only Chrome support
Chrome extension: Only Chrome support
CLI -> HTML: Should support all browsers
Viewer: Should support all browsers
PSI: Should support all browsers
Where "All browsers" == current chrome, saf, ff, edge, but not IE11.
Polyfillin
This JS is essentially concatenated into the compiled-reportrenderer via the html-report-assets inclusion. It runs immediately and exits early if a feature test succeeds:
lighthouse/lighthouse-core/report/html/third_party/details-element-polyfill.js
Lines 13 to 39 in 65f9d6b
Shipping this polyfill this way fixes the CLI and Viewer. PSI is configured separately, but has a similar list of files for inclusion. DevTools is also unaffected, so that's cool. Note, this will add the polyfill superfluously to the extension bundle, but... eh.
@wardpeet note i removed these lines:
lighthouse/lighthouse-core/report/html/report-styles.css
Lines 128 to 131 in 7150174
<details>
but lmk wyt :)