-
Notifications
You must be signed in to change notification settings - Fork 241
Optimizer: ReorderHead has different priorities than in the Go version #579
Copy link
Copy link
Closed
Description
As already discussed, I consider the Go version of the optimizer the canonical one.
The ReorderHead in the JS package puts things into a different order than the Go one. As I'm trying to run both the Go manual tests as well as the JS spec files, this leads to inconsistencies and test failures.
Go:
// ReorderHead reorders the children of <head>. Specifically, it
// orders the <head> like so:
// (0) <meta charset> tag
// (1) <style amp-runtime> (inserted by ampruntimecss.go)
// (2) remaining <meta> tags (those other than <meta charset>)
// (3) AMP runtime .js <script> tag
// (4) AMP viewer runtime .js <script> tag
// (5) <script> tags that are render delaying
// (6) <script> tags for remaining extensions
// (7) <link> tag for favicons
// (8) <link> tag for resource hints
// (9) <link rel=stylesheet> tags before <style amp-custom>
// (10) <style amp-custom>
// (11) any other tags allowed in <head>
// (12) AMP boilerplate (first style amp-boilerplate, then noscript)NodeJS:
/**
* ReorderHeadTransformer - This DOM transformer reorders tags
* within the head. Specifically, it orders the head like so:
* (0) meta charset, then remaining meta tags.
* (1) <style amp-runtime> (inserted by ServerSideRenderingTransformer)
* (2) AMP runtime .js <script> tag
* (3) <script> tags for render delaying extensions
* (4) <script> tags for remaining extensions
* (5) <link> tag for favicon
* (6) <link rel=stylesheet> tags before <style amp-custom>
* (7) <style amp-custom>
* (8) any other tags allowed in <head>
* (9) amp boilerplate (first style amp-boilerplate, then noscript).
*/Is the order of the Go package canonical? If so, why does the JS package diverge? If not, is the Go version out-of-date?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels