File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,14 +76,14 @@ export abstract class NodeComponent<T extends Node> {
7676
7777 /**
7878 * Render this component in the place of a `<slot name="…"></slot>`.
79- * If multiple slots with the same name are found, they will all be used.
79+ * @throws { @link !DOMException } When the slot is not found
8080 * @param slot The slot name
8181 * @param [parent] The parent element within to search for slots. Defaults to `document`
8282 */
8383 public slot ( slot : string , parent : ParentNode = document ) {
84- const slotNodes = parent . querySelectorAll ( `slot[name="${ slot } "]` ) ;
85- for ( const slotNode of slotNodes )
86- slotNode . replaceWith ( this . node ) ;
84+ const slotNode = parent . querySelector ( `slot[name="${ slot } "]` ) ;
85+ if ( slotNode === null ) throw new DOMException ( `Could not find slot " ${ slot } "` ) ;
86+ slotNode . replaceWith ( this . node ) ;
8787 return this ;
8888 }
8989}
You can’t perform that action at this time.
0 commit comments