User Guide

Selection functions 283
dreamweaver.getSelection() (deprecated)
Availability
Dreamweaver 2; deprecated in 3. See dom.getSelection()” on page 280.
Description
Gets the selection in the current document, which is expressed as byte offsets into the document’s
source code.
Arguments
None.
Returns
An array that contains two integers. The first integer is the byte offset for the beginning of the
selection; the second integer is the byte offset for the end of the selection. If the two numbers are
the same, the current selection is an insertion point.
dreamweaver.nodeExists()
Available
Dreamweaver 3.
Description
Determines whether the reference to the specified node is still good. Often when writing
extensions, you reference a node and then perform an operation that deletes it (such as setting the
innerHTML or outerHTML properties of its parent). This function lets you confirm that the node
hasnt been deleted before you attempt to reference any of its properties or methods. The
referenced node does not need to be in the current document.
Arguments
node
The node argument is the node that you want to check.
Returns
A Boolean value: true if the node exists; false otherwise.
Example
The following example gets the current node, locates a table within it, and later calls
dw.nodeExists() to see if the original node still exists:
function applyFormatToSelectedTable(){
// get current selection
var selObj = dw.getDocumentDOM().getSelectedNode();
alternateRows(dwscripts.findDOMObject("presetNames").selectedIndex,
findTable());
// restore original selection, if it still exists; if not, just select the
// table.
000_DW_API_Print.book Page 283 Wednesday, August 20, 2003 9:14 AM