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
Roll forward "Delegate trust check... (#21553)" #21653
Roll forward "Delegate trust check... (#21553)" #21653
Conversation
)" (ampproject#21563)" This reverts commit d96498b.
/to @alabiaga |
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.
We must have more action handlers then this. What about the default handlers? Do they need to be updated too?
* @private | ||
*/ | ||
function isAmpTagName(lowercaseTagName) { | ||
return lowercaseTagName.substring(0, 4) === 'amp-'; |
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.
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.
In the second usage we only have a string (attribute value).
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.
Extract out of isAmpElementTagName
? Either way, you're missing amp-body
and amp-sticky-ad-top-padding
, which are not AMP elements.
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.
Semantics for actions are a bit more complex/confusing e.g. <script id="amp-access">
is not an AMP element but we allow invoking actions on it, so I'd rather not conflate the two by calling isAmpElement()
or similar.
Maybe it should be called "isAmpTarget" rather than "isAmpTagName" though.
Tangent: I actually think isAmpElement
's explicit check for amp-body
etc. isn't great. We should probably duck-type check instead e.g. !!element.isLayoutSupported
.
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.
Tangent: I actually think isAmpElement's explicit check for amp-body etc. isn't great. We should probably duck-type check instead e.g. !!element.isLayoutSupported.
It's intentional because we can't trust that the element has been upgraded already.
Most action handlers are registered on the custom element. This is only for non-CE extensions e.g. form, access. See the comment I added on |
Roll forward #21553 with type and test fixes.