• Skip to main content
  • Skip to search
    • Technologies Overview
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs
    • Browser Extensions
    • MathML
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
    • Send Feedback
    • Contribute to MDN
    • Report a content issue 🌐
    • Report a platform issue 🌐
  1. Web 开发技术
  2. Web API 接口参考
  3. Element
  4. Element.createShadowRoot()
  • Change language
  • View in English

Table of contents

  • 句法
  • 产品规格
  • 浏览器兼容性

Element.createShadowRoot()

使用Element.createShadowRoot 创建的实例 阴影DOM。创建shadow DOM时,它始终附加到现有元素。创建shadow DOM之后,它所附加的元素称为shadow root。

不推荐使用此方法,而使用attachShadow()。

句法

var shadowroot = element.createShadowRoot();

参数

没有参数。

结果值

返回ShadowRoot。

产品规格

任何规格都不再定义此功能。

浏览器兼容性

Found a problem with this page?

  • Source on GitHub
  • Report a problem with this content on GitHub
  • Want to fix the problem yourself? See our Contribution guide.

Last modified: Apr 19, 2021, by MDN contributors

Change your language
  • Web Technologies
  • Learn Web Development
  • About MDN
  • Feedback
  • About
  • MDN Web Docs Store
  • Contact Us
  • Firefox

MDN

Mozilla

© 2005-2021 Mozilla and individual contributors. Content is available under these licenses.

  • Terms
  • Privacy
  • Cookies