• Skip to main content
  • Skip to search
  • Skip to select language
    • 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 technology for developers
  2. Web APIs
  3. ShadowRoot
  4. ShadowRoot.innerHTML
  • Change language

Table of contents

  • Value
  • Examples
  • Specifications
  • Browser compatibility

ShadowRoot.innerHTML

The innerHTML property of the ShadowRoot interface sets or returns a reference to the DOM tree inside the ShadowRoot.

Value

A DOMString.

Examples

let customElem = document.querySelector('my-shadow-dom-element');
let shadow = customElem.shadowRoot;

shadow.innerHTML = '<strong>This element should be more important!</strong>';

Specifications

Specification
DOM Parsing and Serialization
# ref-for-dom-innerhtml-innerhtml-2

Browser compatibility

BCD tables only load in the browser

Found a problem with this page?

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

Last modified: Apr 1, 2022, by MDN contributors

Change your language

Related Topics

  1. ShadowRoot
  2. Properties
    1. activeElement
    2. delegatesFocus
    3. fullscreenElement
    4. host
    5. innerHTML
    6. mode
    7. onslotchange
    8. pictureInPictureElement
    9. pointerLockElement
    10. styleSheets
  3. Methods
    1. getAnimations()
  4. Inheritance:
    1. DocumentFragment
    2. Node
    3. EventTarget
  • Web Technologies
  • Learn Web Development
  • About MDN
  • Feedback
  • About
  • MDN Web Docs Store
  • Contact Us
  • Firefox

MDN

  • MDN on Twitter
  • MDN on Github

Mozilla

  • Mozilla on Twitter
  • Mozilla on Instagram

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

  • Terms
  • Privacy
  • Cookies