Scott Lanning > Mozilla-DOM-0.23 > Mozilla::DOM::Range

Download:
Mozilla-DOM-0.23.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  5
View/Report Bugs
Source  

NAME ^

Mozilla::DOM::Range

Mozilla::DOM::Range is a wrapper around an instance of Mozilla's nsIDOMRange interface. This class inherits from Supports.

 * The nsIDOMRange interface is an interface to a DOM range object.
 *
 * For more information on this interface please see
 * http://www.w3.org/TR/DOM-Level-2-Traversal-Range/

The constants START_TO_START, START_TO_END, END_TO_END, and END_TO_START are available for the "how" argument to CompareBoundaryPoints. You can export them all with use Mozilla::DOM::Range qw(:how) or export them individually.

CLASS METHODS ^

$iid = Mozilla::DOM::Range->GetIID()

Pass this to QueryInterface.

METHODS ^

$node = $range->GetStartContainer()

* Node within which the Range begins

$offset = $range->GetStartOffset()

* Offset within the starting node of the Range.

$node = $range->GetEndContainer()

Node within which the Range ends

$offset = $range->GetEndOffset()

Offset within the ending node of the Range.

$range->SetStart($node, $offset)

Sets the attributes describing the start of the Range.

$range->SetStartBefore($node)

Sets the start position to be before a node

$range->SetStartAfter($node)

Sets the start position to be after a node

$range->SetEnd($node, $offset)

Sets the attributes describing the end of a Range.

$range->SetEndBefore($node)

Sets the end position to be before a node.

$range->SetEndAfter($node)

Sets the end of a Range to be after a node

$range->Collapse($toStart)

Collapse a Range onto one of its boundary-points

$bool = $range->GetCollapsed()

$range->SelectNode($refNode)

Select a node and its contents

$range->SelectNodeContents($node)

Select the contents within a node (i.e. don't include the tags)

$num = $range->CompareBoundaryPoints($how, $sourceRange)

Compare the boundary-points of two Ranges in a document.

Returns -1, 0 or 1 depending on whether the corresponding boundary-point of the Range is respectively before, equal to, or after the corresponding boundary-point of sourceRange.

$range->DeleteContents()

Removes the contents of a Range from the containing document or document fragment without returning a reference to the removed content.

$documentfragment = $range->ExtractContents()

Moves the contents of a Range from the containing document or document fragment to a new DocumentFragment.

$documentfragment = $range->CloneContents()

Duplicates the contents of a Range

$range->InsertNode($node)

Inserts a node into the Document or DocumentFragment at the start of the Range. If the container is a Text node, this will be split at the start of the Range (as if the Text node's splitText method was performed at the insertion point) and the insertion will occur between the two resulting Text nodes. Adjacent Text nodes will not be automatically merged. If the node to be inserted is a DocumentFragment node, the children will be inserted rather than the DocumentFragment node itself.

$range->SurroundContents($newParentNode)

Reparents the contents of the Range to the given node and inserts the node at the position of the start of the Range.

$range->CloneRange($range)

Produces a new Range whose boundary-points are equal to the boundary-points of the Range.

$node = $range->GetCommonAncestorContainer()

The deepest common ancestor container of the Range's two boundary-points.

$str = $range->ToString()

Returns the contents of a Range as a string. This string contains only the data characters, not any markup.

$range->Detach()

Called to indicate that the Range is no longer in use and that the implementation may relinquish any resources associated with this Range. Subsequent calls to any methods or attribute getters on this Range will result in a DOMException being thrown with an error code of INVALID_STATE_ERR.

SEE ALSO ^

Mozilla::DOM

COPYRIGHT ^

Copyright (C) 2005-2007, Scott Lanning

This software is licensed under the LGPL. See Mozilla::DOM for a full notice.

syntax highlighting: