beautypg.com

Dom.striptag(), Dom.wraptag() – Adobe Dreamweaver API Reference CS5 User Manual

Page 473

background image

468

DREAMWEAVER API REFERENCE

Code

Last updated 8/27/2013

Returns
Nothing.

dom.stripTag()

Availability
Dreamweaver 3.

Description
Removes the tag from around the current selection, leaving any contents. If the selection has no tags or contains more
than one tag, Dreamweaver reports an error.

Arguments
None.

Returns
Nothing.

dom.wrapTag()

Availability
Dreamweaver 3.

Description
Wraps the specified tag around the current selection. If the selection is unbalanced, Dreamweaver reports an error.

Arguments

startTag

,

{bAlwaysBalance}

,

{bMakeLegal}

The

startTag

argument is the source that is associated with the opening tag.

The

bAlwaysBalance

argument is a Boolean value that indicates whether to balance the selection before wrapping

it. This argument is optional.

The

bMakeLegal

argument is a Boolean value that indicates whether to ensure that the wrap results in valid HTML.

This argument is optional.

Returns
Nothing.

Example
The following code wraps a link around the current selection:

var theDOM = dw.getDocumentDOM();

var theSel = theDOM.getSelectedNode();
if (theSel.nodeType == Node.TEXT_NODE){

theDOM.wrapTag('');

}