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
hasn’t 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
Summary of Contents for DREAMWEAVER MX 2004-DREAMWEAVER API
Page 1: ...Dreamweaver API Reference...
Page 24: ...24 Contents...
Page 32: ......
Page 70: ...70 Chapter 5 Fireworks Integration...
Page 76: ...76 Chapter 6 Flash Integration...
Page 116: ...116 Chapter 9 The JavaBeans API...
Page 140: ......
Page 152: ...152 Chapter 11 Application...
Page 218: ...218 Chapter 12 Workspace...
Page 248: ...248 Chapter 13 Site...
Page 292: ...292 Chapter 14 Document...
Page 378: ...378 Chapter 17 Design...
Page 430: ...430 Chapter 18 Code...
Page 486: ...486 Index...