ShadowRoot: host-Eigenschaft
        
        
          
                Baseline
                
                  Widely available
                
                
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since Januar 2020.
Die host-Schreibgeschützte Eigenschaft des ShadowRoot gibt eine Referenz auf das DOM-Element zurück, an das das ShadowRoot angehängt ist.
Wert
Ein DOM-Element.
Beispiele
js
const customElem = document.querySelector("my-shadow-dom-element");
const shadow = customElem.shadowRoot;
// …
// return the original host element some time later
const hostElem = shadow.host;
Spezifikationen
| Specification | 
|---|
| DOM> # dom-shadowroot-host> | 
Browser-Kompatibilität
Loading…
Siehe auch
- partund- exportpartsHTML-Attribute
- <template>und- <slot>HTML-Elemente
- :host,- :host()und- :host-context()CSS-Pseudoklassen
- ::partund- ::slottedCSS-Pseudoelemente