User Guide

284 Chapter 14: Document
var selArr;
if (dw.nodeExists(selObj))
selArr = dom.nodeToOffsets(selObj);
else
selArr = dom.nodeToOffsets(findTable());
dom.setSelection(selArr[0],selArr[1]);
}
dreamweaver.nodeToOffsets() (deprecated)
Availability
Dreamweaver 2; deprecated in 3 in favor of “dom.nodeToOffsets()” on page 280.
Description
Gets the position of a specific node in the DOM tree, which is expressed as byte offsets into the
document’s source code.
Arguments
node
The node argument must be a tag, comment, or range of text that is a node in the tree that the
dreamweaver.getDocumentDOM() function returns.
Returns
An array that contains two integers. The first integer is the byte offset for the opening of the tag,
text, or comment; the second integer is the byte offset for the closing of the node.
dreamweaver.offsetsToNode() (deprecated)
Availability
Dreamweaver 2; deprecated in 3 in favor of “dom.offsetsToNode()” on page 281.
Description
Gets the object in the DOM tree that completely contains the range of characters between the
specified opening and closing points.
Arguments
offsetBegin
, offsetEnd
These arguments are the opening and closing points, respectively, of a range of characters,
which is expressed as byte offsets into the document’s source code.
Returns
The tag, text, or comment object that completely contains the specified range of characters.
000_DW_API_Print.book Page 284 Wednesday, August 20, 2003 9:14 AM