DocumentFragment.querySelectorAll()
方法返回
NodeList
of elements within the
DocumentFragment
(using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors.
If the selectors specified in parameter are invalid a
DOMException
采用
SYNTAX_ERR
value is raised.
注意:
The definition of this API was moved to the
ParentNode
接口。
elementList = documentfragment.querySelectorAll(selectors);
DOMString
containing one or more CSS selectors separated by commas.
This example returns a list of all
div
elements within the
DocumentFragment
with a class of either "
note
" or "
alert
":
var matches = documentfrag.querySelectorAll("div.note, div.alert");
| 规范 | 状态 | 注释 |
|---|---|---|
|
Selectors API Level 1
The definition of 'DocumentFragment.querySelectorAll' in that specification. |
过时 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
querySelectorAll
|
Chrome 1 | Edge 12 | Firefox 3.5 | IE 9 | Opera 10 | Safari 3.2 | WebView Android Yes | Chrome Android Yes | Firefox Android 4 | Opera Android 10.1 | Safari iOS 3.2 | Samsung Internet Android Yes |
完整支持
DocumentFragment
interface it belongs to.
DocumentFragment
append()
prepend()
querySelector()
querySelector()
querySelectorAll()
querySelectorAll()
replaceChildren()
AbortController
AbortSignal
AbstractRange
Attr
ByteString
CDATASection
CSSPrimitiveValue
CSSValue
CSSValueList
CharacterData
ChildNode
注释
CustomEvent
DOMConfiguration
DOMError
DOMErrorHandler
DOMException
DOMImplementation
DOMImplementationList
DOMImplementationRegistry
DOMImplementationSource
DOMLocator
DOMObject
DOMParser
DOMPoint
DOMPointInit
DOMPointReadOnly
DOMRect
DOMString
DOMTimeStamp
DOMTokenList
DOMUserData
Document
DocumentType
元素
ElementTraversal
Entity
EntityReference
事件
EventTarget
HTMLCollection
MutationObserver
节点
NodeFilter
NodeIterator
NodeList
NonDocumentTypeChildNode
ProcessingInstruction
PromiseResolver
范围
StaticRange
文本
TextDecoder
TextEncoder
TimeRanges
TreeWalker
TypeInfo
USVString
UserDataHandler
XMLDocument