StaticRange()
构造函数创建新
StaticRange
object representing a span of content within the DOM.
It includes properties identifying the standard and end positions of the range as well as a Boolean indicating whether or not the range is
collapsed
(that is, empty).
var staticRange = new StaticRange(rangeSpec)
rangeSpec
要求
rangeSpec
parameter is an object adhering to the
StaticRangeInit
dictionary. The four required
rangeSpec
properties are:
startContainer
节点
in which the starting point of the range is located.
startOffset
The offset into the starting node at which the first character of the range is found.
endContainer
节点
in which the end point of the range is located.
endOffset
endOffset
at which the last character in the range is located.
新的
StaticRange
object initialized with the values given in the
rangeSpec
对象。
InvalidNodeTypeError
DOMException
fired if either or both of the
startContainer
and/or
endContainer
are a type of node which you can't include in a range. Those node types are
Node.DOCUMENT_TYPE_NODE
(representing the
DocumentType
node derived from the
DTD
identified using the
doctype
preamble in the HTML, for example) and the
Attr
node describing an attribute of an element on the DOM..
| 规范 | 状态 | 注释 |
|---|---|---|
|
DOM
The definition of 'StaticRange()' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
StaticRange()
构造函数
|
Chrome 不支持 No | Edge 不支持 No | Firefox 71 | IE 不支持 No | Opera 不支持 No | Safari 13.1 | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS 13.4 | Samsung Internet Android 不支持 No |
完整支持
不支持
StaticRange
StaticRange()
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
DocumentFragment
DocumentType
元素
ElementTraversal
Entity
EntityReference
事件
EventTarget
HTMLCollection
MutationObserver
节点
NodeFilter
NodeIterator
NodeList
NonDocumentTypeChildNode
ProcessingInstruction
PromiseResolver
范围
文本
TextDecoder
TextEncoder
TimeRanges
TreeWalker
TypeInfo
USVString
UserDataHandler
XMLDocument