Closed vidhu closed 4 years ago
Can you share a sample use case on a valid AMP page? AMP doesn't allow <script>
as written above.
It's not possible to polyfill HTMLElement
and preserve the instanceof
check here. Custom elements are required to use Foo extends HTMLElement
, which means we must change the value of HTMLElement
global. Natively constructed elements will still inherit directly from the intrinsic class, regardless of the global's current value. So div instanceof HTMLElement
can't be properly done.
Will it be safe to assume div instanceof Element
would work as a workaround for a future?
When we no longer need the polyfill. This requires that both the browser natively support Custom Elements v1, and the project must not compile native classes to ES5. We're actively working on the second, and the first just takes time.
Any solution for this?
What's the issue?
HTMLElement
is overridden by a polyfill. This causes theinstanceOf
operator to returnfalse
in cases where it should returntrue
How do we reproduce the issue?
Here is a minimal reproducible example
The console should log out
true
since<div id="test"></div>
is an instance ofHTMLElement
however it logs out false.Running example
What browsers are affected?
All browsers?
Which AMP version is affected?
Version 2001071857360