Obiekt
Range
reprezentuje fragment dokumentu, kt贸ry stanowi w臋ze艂 oraz cz臋艣膰 w臋z艂a tekstowego w danym dokumencie.
A range can be created using the createRange
method of the Document
object. Range objects can also be retrieved by using the getRangeAt
method of the selection
object.
W艂asno艣ci
- collapsed
- Returns a boolean indicating whether the range's start and end points are at the same position.
- commonAncestorContainer
- Returns the deepest Node that contains the startContainer and endContainer Nodes.
- endContainer
- Returns the Node within which the Range ends.
- endOffset
- Returns a number representing where in the endContainer the Range ends.
- startContainer
- Returns the Node within which the Range starts.
- startOffset
- Returns a number representing where in the startContainer the Range starts.
Metody
Metody pozycjonowania
Te metody ustawiaj膮 punkt pocz膮tkowy i ko艅cowy obiektu range.
- setStart
- Ustawia pozycj臋 pocz膮tkow膮 obiektu range.
- setEnd
- Ustawia pozycj臋 ko艅cow膮 obiektu range.
- setStartBefore
- Ustawia pozycj臋 pocz膮tkowa dla obiektu range w odniesieniu do innego w臋z艂a.
- setStartAfter
- Ustawia pozycj臋 pocz膮tkowa dla obiektu range w odniesieniu do innego w臋z艂a.
- setEndBefore
- Ustawia pozycj臋 ko艅cow膮 dla obiektu range w odniesieniu do innego w臋z艂a.
- setEndAfter
- Ustawia pozycj臋 ko艅cow膮 dla obiektu range w odniesieniu do innego w臋z艂a.
- selectNode
- Ustawia obiekt range, aby zawiera艂 w臋ze艂 wraz z jego zawarto艣ci膮.
- selectNodeContents
- Ustawia obiekt range, aby zawiera艂 zawarto艣膰 w臋z艂a.
- collapse
- Zawija obiekt range do jednego z jego punkt贸w granicznych.
Metody edytuj膮ce
These methods retrieve Nodes from a range and modify the contents of a range.
- cloneContents
- Returns a document fragment copying the nodes of a Range.
- deleteContents
- Removes the contents of a Range from the document.
- extractContents
- Moves contents of a Range from the document tree into a document fragment
- insertNode
- Insert a node at the start of a Range.
- surroundContents
- Moves content of a Range into a new node.
Inne metody
- compareBoundaryPoints
- Por贸wnuje punkty graniczne dw贸ch obiekt贸w range.
- cloneRange
- Zwraca obiekt range z punktami granicznymi identycznymi z klonowanym obiektem range.
- detach
- Releases Range from use to improve performance.
- toString
- Zwraca tekst z obiektu range.
Metody Gecko
Ta sekcja opisuje szczeg贸lne metody Range
Mozilli nie b臋d膮ce cz臋艣ci膮 specyfikacji W3C DOM.
- compareNode
- Zwraca sta艂膮 opisuj膮c膮 czy w臋ze艂 znajduje si臋 przed, za, wewn膮trz lub otacza obiekt range .
- comparePoint
- Zwraca -1, 0 lub 1 wskazuj膮c czy punkt por贸wnania wyst臋puje przed, wewn膮trz lub za obiektem range.
- createContextualFragment
- Zwraca fragment dokumentu utworzony z danego 艂a艅cucha kodu.
- intersectsNode
- Zwraca warto艣膰 Boolean okre艣laj膮c膮 czy dany w臋ze艂 przecina obiekt range.
- isPointInRange
- Zwraca warto艣膰 Boolean okre艣laj膮c膮 czy dany punkt jest zawarty w obiekcie range.