beautypg.com

Elem.isblockelement() – Adobe Dreamweaver API Reference CS5 User Manual

Page 348

background image

343

DREAMWEAVER API REFERENCE

Page content

Last updated 8/27/2013

Arguments
None.

Returns
An array of element nodes.

Example

[...]

var DOM = dw.getDocumentDOM();
// get all the UL, OL, and DL elements in the document.
var lists = DOM.getListElements();
var props = null;
for (var i=0; i < lists.length; i++){

props = window.getDeclaredStyle(lists[i]);
if ((props.cssFloat == "left" || props.cssFloat == "right") && props.overflow == "auto"){

// do something

}

}
[...]

elem.isBlockElement()

Availability
Dreamweaver CS3.

Description
Checks whether the element has an inherent or specified display value of

'block'

.

Arguments
None.

Returns
A Boolean value indicating whether the object is a block-level element.

Example

[...]

var DOM = dw.getDocumentDOM();
var blocks = DOM.body.getBlockElements();
var next = null;
for (var i=0; i < blocks.length; i++){

// next is the node right after blocks[i]
next = blocks[i].nextSibling;
// if next isn't null AND next is an element node AND next is a block element,
// we've met the "second of two consecutive block elements" test.
if (next && (next.nodeType == 1) && next.isBlockElement()){
// do something

}

}
[...]