-
Notifications
You must be signed in to change notification settings - Fork 243
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
Filter duplicate extensions by src URL #1192
Changes from 1 commit
2efc49d
d96effd
118fab7
ec427be
0ce925f
85396ef
63ef718
68804c2
3192282
6901062
f8d0d1c
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 |
---|---|---|
|
@@ -50,12 +50,12 @@ class HeadNodes { | |
} | ||
|
||
_removeDuplicateCustomExtensions(extensions) { | ||
const nodesByName = new Map(); | ||
const nodesBySrc = new Map(); | ||
for (const node of extensions) { | ||
const name = this._getName(node); | ||
nodesByName.set(name, node); | ||
const src = node.attribs['src']; | ||
nodesBySrc.set(src, node); | ||
} | ||
return Array.from(nodesByName.values()); | ||
return Array.from(nodesBySrc.values()); | ||
} | ||
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. I took an alternative approach to this in PHP, to do the deduplication in the This also accounts for |
||
|
||
appendToHead(head) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css"> | ||
<script async src="https://cdn.ampproject.org/v0.mjs" type="module" crossorigin="anonymous"></script> | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
<script async nomodule src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js" custom-element="amp-experiment"></script> | ||
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.mjs" type="module" crossorigin="anonymous"></script> | ||
<script async nomodule src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js" custom-template="amp-mustache"></script> | ||
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.mjs" type="module" crossorigin="anonymous"></script> | ||
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 the order be reversed, with 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. done |
||
<link href="https://example.com/favicon.ico" rel="icon"> | ||
<link rel="preload" href="https://cdn.ampproject.org/v0.css" as="style"> | ||
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css"> | ||
<link as="script" crossorigin="anonymous" href="https://cdn.ampproject.org/v0.mjs" rel="modulepreload"> | ||
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. Shouldn't 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. Done 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. This 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. Thanks for the patience taking it up with my empty brain today... |
||
</head> | ||
<body></body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<script async nomodule src="https://cdn.ampproject.org/v0.js"></script> | ||
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. Big problem: 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. fixed |
||
<script async src="https://cdn.ampproject.org/v0.mjs" type="module" crossorigin="anonymous"></script> | ||
<script async nomodule src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js" custom-template="amp-mustache"></script> | ||
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.mjs" type="module" crossorigin="anonymous"></script> | ||
<script async nomodule src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js" custom-element="amp-experiment"></script> | ||
<script async nomodule src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js" custom-element="amp-experiment"></script> | ||
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.mjs" type="module" crossorigin="anonymous"></script> | ||
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.mjs" type="module" crossorigin="anonymous"></script> | ||
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css"> | ||
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css"> | ||
<link href="https://example.com/favicon.ico" rel="icon"> | ||
<link as="script" crossorigin="anonymous" href="https://cdn.ampproject.org/v0.mjs" rel="modulepreload"> | ||
<link rel="preload" href="https://cdn.ampproject.org/v0.css" as="style"> | ||
</head> | ||
<body></body> | ||
</html> |
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.
Shouldn't this remove the host to make sure a same extension is not downloaded twice from two different hosts?