Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Unified Diff: third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/dom.js

Issue 2888263002: DevTools: Roll Lighthouse binary to 2.0.1-alpha.0 (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/dom.js
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/dom.js b/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/dom.js
index 28e02dac9ffc9da49f2bb8776f0055fee1dc6f18..83ab5fdae12c7927a2e2c3639b194a2dd728b29e 100644
--- a/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/dom.js
+++ b/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/dom.js
@@ -101,7 +101,7 @@ class DOM {
* @param {string} text
* @return {!Element}
*/
- createSpanFromMarkdown(text) {
+ convertMarkdownLinkSnippets(text) {
const element = this.createElement('span');
// Split on markdown links (e.g. [some link](https://...)).
@@ -126,6 +126,28 @@ class DOM {
return element;
}
+ /**
+ * @param {string} text
+ * @return {!Element}
+ */
+ convertMarkdownCodeSnippets(text) {
+ const element = this.createElement('span');
+
+ const parts = text.split(/`(.*?)`/g); // Split on markdown code slashes
+ while (parts.length) {
+ // Pop off the same number of elements as there are capture groups.
+ const [preambleText, codeText] = parts.splice(0, 2);
+ element.appendChild(this._document.createTextNode(preambleText));
+ if (codeText) {
+ const pre = /** @type {!HTMLPreElement} */ (this.createElement('code'));
+ pre.textContent = codeText;
+ element.appendChild(pre);
+ }
+ }
+
+ return element;
+ }
+
/**
* @return {!Document}
*/

Powered by Google App Engine
This is Rietveld 408576698