aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/api/htmlslotelement/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
commit4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch)
treed4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/de/web/api/htmlslotelement/index.html
parent33058f2b292b3a581333bdfb21b8f671898c5060 (diff)
downloadtranslated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip
initial commit
Diffstat (limited to 'files/de/web/api/htmlslotelement/index.html')
-rw-r--r--files/de/web/api/htmlslotelement/index.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/files/de/web/api/htmlslotelement/index.html b/files/de/web/api/htmlslotelement/index.html
new file mode 100644
index 0000000000..2644171f01
--- /dev/null
+++ b/files/de/web/api/htmlslotelement/index.html
@@ -0,0 +1,67 @@
+---
+title: HTMLSlotElement
+slug: Web/API/HTMLSlotElement
+tags:
+ - API
+ - HTMLSlotElement
+ - Interface
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+ - shadow dom
+translation_of: Web/API/HTMLSlotElement
+---
+<p>{{APIRef('Web Components')}}</p>
+
+<p>The <strong><code>HTMLSlotElement</code></strong> interface of the <a href="/en-US/docs/Web/Web_Components/Shadow_DOM">Shadow DOM API</a> enables access to the name and assigned nodes of an HTML {{HTMLElement("slot")}} element.</p>
+
+<h2 id="Properties">Properties</h2>
+
+<dl>
+ <dt>{{domxref('HTMLSlotElement.name')}}</dt>
+ <dd>{{domxref("DOMString")}}: Can be used to get and set the slot's name.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<dl>
+ <dt>{{domxref('HTMLSlotElement.assignedNodes()')}}</dt>
+ <dd>Returns the sequence of elements assigned to this slot, or alternatively the slot's fallback content.</dd>
+</dl>
+
+<h2 id="Examples">Examples</h2>
+
+<p>The following snippet is taken from our <a href="https://github.com/mdn/web-components-examples/tree/master/slotchange">slotchange example</a> (<a href="https://mdn.github.io/web-components-examples/slotchange/">see it live also</a>).</p>
+
+<pre class="brush: js">let slots = this.shadowRoot.querySelectorAll('slot');
+slots[1].addEventListener('slotchange', function(e) {
+  let nodes = slots[1].assignedNodes();
+  console.log('Element in Slot "' + slots[1].name + '" changed to "' + nodes[0].outerHTML + '".');
+});</pre>
+
+<p>Here we grab references to all the slots, then add a slotchange event listener to the 2nd slot in the template — which is the one that keeps having its contents changed in the example.</p>
+
+<p>Every time the element inserted in the slot changes, we log a report to the console saying which slot has changed, and what the new node inside the slot is.</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG','scripting.html#htmlslotelement','HTMLSlotElement')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.HTMLSlotElement")}}</p>