beautypg.com

Dom.getmindisplaywidth() – Adobe Dreamweaver API Reference CS5 User Manual

Page 344

background image

339

DREAMWEAVER API REFERENCE

Page content

Last updated 8/27/2013

Description
Gets the CSS styles that are declared for the specified element. Differs from the

getComputedStyle()

function in that

styles that are not specifically declared are undefined, and it gives actual length values as declared in the style sheet (e.g.,
20%, .8em) rather than computed pixel values. If

bGetInherited

is false (default case),

getDeclaredStyle()

also

gets only the styles that directly apply to the element; it does not include styles that are inherited from a parent.

Arguments
elt, pseudoElt, psuedoClassList, bGetInherited

elt - a node in the document whose style information is desired

pseudoElt - the CSS pseudoelement, or

null

if there is none

psuedoClassList - an optional string consisting of a space-separated list of pseudoclasses

bGetInherited - an optional Boolean value indicating whether to include styles inherited from ancestors (defaults
to

false

).

Returns
A read-only object containing style properties that can be accessed by name.

Example

var dom = dw.getDocumentDOM();

var myDiv = dom.getElementById('myDiv');
var props = window.getDeclaredStyle(myDiv);
var marleft = "";
var units = "";
if (typeof(props.marginLeft) != "undefined"){

marleft = props.marginLeft;
units = marleft.replace(/\d+/,""); // remove digits, leaving units
alert(units); // should show %, px, pt, em, etc.

}
else
alert("no margin-left property has been set for myDiv.");

dom.getMinDisplayWidth()

Availability
Dreamweaver CS3.

Description
Gets the minimum width required for a block-level container to display its entire contents.

Note: The actual width of the container could be smaller if a value less than the value that the

dom.minDisplayWidth()

function returns is specified by using CSS.

Arguments
container

container is the containing element for which a minimum width is required.