how to detect if browsers support custom elements

早过忘川 提交于 2019-12-04 09:27:55

Modernizr doesn't have a test for this at the moment, however since it has an API to create the element, it should be as simple as

var supportsCustomElements = ('registerElement' in document)

to detect for v0 of the API. To check for the more up to date v1, its

var supportsCustomElements = ('customElements' in window)

(more info on the in operator)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!