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

Add extension scripts in logical order #1143

Merged

Conversation

schlessera
Copy link
Collaborator

When an extension is added by the AutoExtensionsImporter in the current code, the referenceNode is never updated, so all extensions are inserted immediately after the viewport node.

This causes the extensions to be written into the markup in the opposite order in which they are detected:

C
B
A

This seems illogical and might lead to bugs in case ordering would be import.

This PR changes the code so that the referenceNode is always moved forward when an extension is added, and therefore keeps the ordering of the extensions intact:

A
B
C

Copy link
Collaborator

@sebastianbenz sebastianbenz left a comment

Choose a reason for hiding this comment

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

Nice - thanks!

@sebastianbenz sebastianbenz merged commit 89d7233 into ampproject:main Feb 22, 2021
@schlessera schlessera deleted the fix/add-extensions-in-logical-order branch February 22, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants