Dreamweaver.cssstylepalette.getstyles() – Adobe Dreamweaver API Reference CS5 User Manual

Page 398

Advertising
background image

393

DREAMWEAVER API REFERENCE

Design

Last updated 8/27/2013

Arguments
fullSelector

The fullSelector argument is a Boolean value that indicates whether the full selector or only the class should return.
If nothing is specified, only the class name returns. For instance,

p.class1

is a selector that means the style is

applied to any

p

tag of

class1

, but it does not apply, for instance, to a

div

tag of

class1

. Without the fullSelector

argument, the

dreamweaver.cssStylePalette.getSelectedStyle()

function returns only the class name,

class1

, for the selector. The fullSelector argument tells the function to return

p.class1

instead of

class1

.

Returns
When the fullSelector argument is a

true

value, the function returns either the full selector or an empty string when

the stylesheet node is selected.

When the fullSelector argument is a

false

value or it is omitted, a string that represents the class name of the selected

style returns. If the selected style does not have a class or a stylesheet node is selected, an empty string returns.

Example
If the style

red

is selected, a call to the

dw.cssStylePalette.getSelectedStyle()

function returns

"red"

.

dreamweaver.cssStylePalette.getStyles()

Availability
Dreamweaver 3.

Description
Gets a list of all the class styles in the active document. Without arguments it just returns class selector names. If the
bGetIDs argument is

true

, it returns just ID selector names. In either case, if the bGetFullSelector argument is

true

, it

returns the full selector name.

For example, given an HTML file with the following code:

<style>

.test{ background:none };
p.foo{ background:none };
#bar {background:none };
div#hello p.world {background:none};

The calls in the following table return the values in the Result column.

Arguments
{bGetIDs}, {bGetFullSelector}

The bGetIDs argument is optional. It is a Boolean value that, if

true

, causes the function to return just ID selector

names (the part after the "#"). Defaults to

false

.

Function call

Result

dw.cssStylePalette.getStyles()

foo, test, world

dw.cssStylePalette.getStyles(true)

bar, hello

dw.cssStylePalette.getStyles(false, true)

p.foo, .test, div#hello p.world

dw.cssStylePalette.getStyles(true, true)

#bar, div#hello p.world

Advertising