-
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: introduce the new report api, add dom.rootEl #13277
Changes from all commits
60e38ee
9d0326b
f059abd
da84011
c18bd48
349a655
f6003b6
4c2f18f
743b1ea
94823f3
5e84263
e122e5d
38db26b
d8aa593
399cd3c
96cbb47
2b08fc2
0c2f103
bff39ee
501a980
37bf128
69a7fed
cdac9fc
5f95ff3
cc6f08a
c1f94cb
ce7dd3e
cc119a2
7779f25
69e7a48
a572b9c
66216a9
3058b57
e0bf5a5
c9ba910
6e19522
88b6c23
7c21389
871e8e5
91390dc
6c4d3df
eeb5a2b
b6aaf01
4187992
033a453
536f4cf
db94ac1
7384079
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,12 +21,11 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> | ||
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEhklEQVR4AWJxL/BhIAesev1U5tcflpncgNrKIsqNIwzC9feMpDUzs70kOczMzMzJJcxwCTMzncPMnOwtzBwzMzPb0vRfeZPp0VhPS5I39V5fdiXV1/VD+9QC7OVn9BsyH1XIoEI1PfmJvLFowVV564+34DFUHudbmfDh4kVXh//7XwE+WjS/YfXZe3yr4j2rqj1AIhSB7hZ8ZtPZu/zw8cK523U4wE1/rvPfWrz4zs0m9ZdC9yUJAlASdBAgocRegfF/f3/h/PuaFsxMdwjAR0vm1+06eMMfIrhLqTWqdH4EumU2SPfMhigJAlRQbZrgrRsl9U+Y2DYDFCz3ILC9kiAiqSrMwbWT0nceEnR+9Kggc2zjOJCASDENkg0a5HfZZgDP81CM3CrQs2Z1+o7DJ6ePr8sK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q2nGhAHtBqDpOuI/I1diUUAMYIxEdyejBJqLnNoszGZtfiX/CztGv2mq+sdaAAAAAElFTkSuQmCC"> | ||
<title>Lighthouse Report</title> | ||
<style>body {margin: 0}</style> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add this to the flow template as well, or maybe put in shared styles somehow? |
||
</head> | ||
<body class="lh-root lh-vars"> | ||
<body> | ||
<noscript>Lighthouse report requires JavaScript. Please enable.</noscript> | ||
|
||
<main><!-- report populated here --></main> | ||
|
||
<div id="lh-log"></div> | ||
|
||
<script>window.__LIGHTHOUSE_JSON__ = %%LIGHTHOUSE_JSON%%;</script> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
|
||
import {DOM} from '../renderer/dom.js'; | ||
import {ReportRenderer} from '../renderer/report-renderer.js'; | ||
import {ReportUIFeatures} from '../renderer/report-ui-features.js'; | ||
|
||
/** | ||
* @param {LH.Result} lhr | ||
* @param {LH.Renderer.Options} opts | ||
* @return {HTMLElement} | ||
*/ | ||
export function renderReport(lhr, opts = {}) { | ||
const rootEl = document.createElement('article'); | ||
rootEl.classList.add('lh-root', 'lh-vars'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The standalone template HTML already includes these classes in a Standalone renderer would still look for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. basically did the same kinda thing. just avoiding a double-main scenario. :) |
||
|
||
const dom = new DOM(rootEl.ownerDocument, rootEl); | ||
const renderer = new ReportRenderer(dom); | ||
|
||
renderer.renderReport(lhr, rootEl, opts); | ||
|
||
// Hook in JS features and page-level event listeners after the report | ||
// is in the document. | ||
const features = new ReportUIFeatures(dom, opts); | ||
features.initFeatures(lhr); | ||
return rootEl; | ||
} |
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.
Todo for me to add these programmatically in the flow report.