瀏覽代碼

Explain querySelector usage in x-teleport docs (#2435)

* Explain querySelector usage in x-teleport docs

* Revert "Explain querySelector usage in x-teleport docs"

This reverts commit db1dce76fcbfe65ef4237ab8ea2a21432238fbff.

* Explain x-template usage with querySelector
Stephen Rees-Carter 3 年之前
父節點
當前提交
0d61f61d7a
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      packages/docs/src/en/directives/teleport.md

+ 3 - 1
packages/docs/src/en/directives/teleport.md

@@ -18,7 +18,9 @@ This is useful for things like modals (especially nesting them), where it's help
 
 By attaching `x-teleport` to a `<template>` element, you are telling Alpine to "append" that element to the provided selector.
 
-> The `x-template` selector can be any string you would normally pass into something like `document.querySelector`
+> The `x-template` selector can be any string you would normally pass into something like `document.querySelector`. It will find the first element that matches, be it a tag name (`body`), class name (`.my-class`), ID (`#my-id`), or any other valid CSS selector.
+
+[→ Read more about `document.querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector)
 
 Here's a contrived modal example: