Skip to content
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: use details-element-polyfill from node_modules #6593

Merged
merged 2 commits into from
Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lighthouse-core/report/html/html-report-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

const fs = require('fs');

// COMPAT: Remove when Microsoft Edge supports <details>/<summary>
// https://developer.microsoft.com/en-us/microsoft-edge/platform/status/detailssummary/?q=details
const detailsPath = require.resolve('details-element-polyfill/dist/details-element-polyfill.js');

const REPORT_TEMPLATE = fs.readFileSync(__dirname + '/report-template.html', 'utf8');
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>
// https://developer.microsoft.com/en-us/microsoft-edge/platform/status/detailssummary/?q=details
fs.readFileSync(__dirname + '/third_party/details-element-polyfill.js', 'utf8'),
fs.readFileSync(detailsPath),
fs.readFileSync(__dirname + '/renderer/details-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/crc-details-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/../../lib/file-namer.js', 'utf8'),
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/report/html/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ The renderer was designed to be portable across various environments.

### Polyfills

The `details-element-polyfill` is pulled in to provide [support](https://caniuse.com/#feat=details) for Microsoft Edge. It's built [unminified](https://github.com/javan/details-element-polyfill/issues/12) and pulled into third_party.
The [`details-element-polyfill`](https://www.npmjs.com/package/details-element-polyfill/v/2.1.1) is pulled in to provide [support](https://caniuse.com/#feat=details) for Microsoft Edge.
5 changes: 0 additions & 5 deletions lighthouse-core/report/html/report-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@
display: none !important;
}

/* Edge doesn't recognize these, and the polyfill doesn't set block. https://github.com/javan/details-element-polyfill/issues/13 */
details, summary {
display: block;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉


.lh-root details > summary {
cursor: pointer;
}
Expand Down
21 changes: 0 additions & 21 deletions lighthouse-core/report/html/third_party/LICENSE

This file was deleted.

295 changes: 0 additions & 295 deletions lighthouse-core/report/html/third_party/details-element-polyfill.js

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"chrome-launcher": "^0.10.5",
"configstore": "^3.1.1",
"cssstyle": "1.1.1",
"details-element-polyfill": "2.1.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

locked to the same version we use for LR

"esprima": "^4.0.1",
"http-link-header": "^0.8.0",
"inquirer": "^3.3.0",
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
],
"exclude": [
"lighthouse-cli/test/**/*.js",
"lighthouse-core/report/html/third_party/",
"lighthouse-core/test/**/*.js",
"clients/test/**/*.js",
]
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,11 @@ des.js@^1.0.0:
inherits "^2.0.1"
minimalistic-assert "^1.0.0"

details-element-polyfill@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/details-element-polyfill/-/details-element-polyfill-2.1.1.tgz#4faa3f0823e834cfa628319bb815a30a4d11f926"
integrity sha512-OY53M2EFudCds5y2mmQSQztOZaMJA4EzBDusMa/J52qHxa8NJrMZEGnj0MfHtLagZPwru9yQYR/KNUXhGX37uQ==

detect-file@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-0.1.0.tgz#4935dedfd9488648e006b0129566e9386711ea63"
Expand Down