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

🐛Only add runtime classNames custom-elements not in templates #19260

Merged
merged 1 commit into from Nov 12, 2018

Conversation

cvializ
Copy link
Contributor

@cvializ cvializ commented Nov 12, 2018

Fixes #18183

In browsers that do not support <template> natively, AMP custom-elements in templates have runtime classNames added. I believe this is not the intended behavior.

This caused problems when parent elements called measureMutateElement. measureMutateElement queries child elements with the i-amphtml-element className and attempts to reference their resources_ methods. The custom-elements inside the templates are assigned the runtime classNames, but don't reach the code path where their resources_ get assigned, and so a Reference Error would occur.

This PR fixes that error from occurring by exiting from connectedCallback before the runtime classnames are added. This prevents measureMutateElement from querying custom-elements inside <template> tags.

Do you foresee any issues with this approach?

/to @jridgewell @choumx
/cc @dvoytenko

@cvializ cvializ changed the title Only attach internal classNames to elements not in templates Only add internal classNames to elements not in templates Nov 12, 2018
@cvializ cvializ changed the title Only add internal classNames to elements not in templates 🐛Only add runtime classNames custom-elements not in templates Nov 12, 2018
@cvializ cvializ merged commit f18f7eb into ampproject:master Nov 12, 2018
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.

amp form action-xhr does not work in IE 11
4 participants