-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🚮 Eliminate elementName method #27470
Conversation
It's equivalent to the Element's `localName` in every case we care about. Also eliminates a bit of constructor cruft from the CEv0 days.
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.
LGTM
self = super(self); | ||
self.createdCallback(); | ||
return self; | ||
/** */ |
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.
Does something complain when removing this empty comment?
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.
What is Element.localName
in the "no CE" polyfill case (IE 11)?
Excellent question, and one I hadn't tested. Thankfully, IE11 does the right thing and reports the lowercased name, like all the other browsers. |
This is a continuation of ampproject#25245. All of our Custom Elements extend from a common `CustomAmpElement` class, which itself extends from `HTMLElementPolyfill`. In ampproject#27470, I removed the `constructor` from `CustomAmpElement` class. But, because it's a subclass and must have a `constructor` that calls `super()`, Closure replaced it with a `constructor() { superClass.apply(this, arguments); }` when transpiling. But, due to the same faulty inheritance chain described in ampproject#25245, `HTMLElementPolyfill` doesn't inherit an `apply` method! So doing `superClass.apply()` throws an error. 😭 This PR installs all important Function methods onto our polyfill, to be resilient to any future changes in the instance creation.
This reverts commit fc69bcf.
It's equivalent to the Element's
localName
in every case we care about. Also eliminates a bit of constructor cruft from the CEv0 days.