beautypg.com

Browser compatibility check functions, Elem.getcomputedstyleprop(), Window.getdeclaredstyle() – Adobe Dreamweaver API Reference CS5 User Manual

Page 343

background image

338

DREAMWEAVER API REFERENCE

Page content

Last updated 8/27/2013

Browser compatibility check functions

The following functions facilitate locating combinations of HTML and CSS that can trigger browser rendering bugs
(for more information, refer to "The Browser Compatibility Check Issues API" chapter in Extending Dreamweaver),
but they can also be used in other types of extensions (such as Commands).

Note: The values that these functions return represent the styles currently in effect in Design view. When the functions
are used in Issue files as part of a browser compatibility check, Dreamweaver automatically filters the styles based on how
the target browsers would read them (for example, styles defined using Star HTML are taken into account if the target
browser is Internet Explorer 6 or earlier), but this filtering is not done when you use the functions outside the scope of a
browser compatibility check.

elem.getComputedStyleProp()

Availability
Dreamweaver CS3.

Description
Gets the value of the specified CSS property that is used to render the specified element, regardless of where the
property is specified in the cascade. Lengths are reported in pixels (although, unlike the browsers, “px” is not specified
with the value).

Arguments
propName, pseudoElt

The propName argument is the name of a CSS property (use intercaps in place of hyphens; for example,

"font-

size"

would become

"fontSize"

).

The pseudoElt argument is the CSS pseudoelement, or

null

if there is none.

Returns
A string containing the computed value for the property.

Note: Numerical values are also returned as strings; to use these values in calculations, convert them to numbers with

parseInt()

or

parseFloat()

.

Example

var dom = dw.getDocumentDOM();

var myDiv = dom.getElementsByTagName('myDiv');
var float = myDiv.getComputedStyleProp("float");
if (float == "left")

alert("This div is floated left.");

window.getDeclaredStyle()

Availability
Dreamweaver CS3.