这篇翻译不完整。请帮忙从英语翻译这篇文章

is 全局属性( global attribute )允许您指定标准HTML元素像定义的内置元素一样工作(请参阅使用自定义元素( Using custom elements )以获取更多详细信息)。

只有在当前文档中已成功定义( defined )指定的自定义元素名称并且扩展了要应用的元素类型时,才能使用此属性。

示例

 以下代码来自我们的 word-count-web-component 示例(see it live also)。

// Create a class for the element
class WordCount extends HTMLParagraphElement {
  constructor() {
    // Always call super first in constructor
    super();

    // Constructor contents ommitted for brevity
    ...

  }
}

// Define the new element
customElements.define('word-count', WordCount, { extends: 'p' });
<p is="word-count"></p>

规范

Specification Status Comment
HTML Living Standard
is
Living Standard  

浏览器兼容

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 67Edge No support NoFirefox Full support 63
Full support 63
Full support 59
Disabled
Disabled From version 59: this feature is behind the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No support ? — 59
Disabled
Disabled Until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true) and the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 55Safari No support NoWebView Android Full support 67Chrome Android Full support 67Edge Mobile No support NoFirefox Android Full support 63
Full support 63
Full support 59
Disabled
Disabled From version 59: this feature is behind the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No support ? — 59
Disabled
Disabled Until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true) and the dom.webcomponents.customelements.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support 55Safari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.

参见

 

文档标签和贡献者

此页面的贡献者: Kollar93
最后编辑者: Kollar93,