Class: StyleUtils

Kekule. StyleUtils

new StyleUtils()

Util methods about CSS and style values.
Source:

Methods

(static) analysisUnitsValue(value) → {Hash}

Split a units value to {value, units} hash.
Parameters:
Name Type Description
value String
Source:
Returns:
Type
Hash

(static) colorStrToValue(str)

Turn a #RRGGBB or #RGB style string to a integer value.
Parameters:
Name Type Description
str String
Source:

(static) getComputedStyle(elem, propName) → {Variant}

Returns computed style of element. If propName not set, all computed result will be returned.
Parameters:
Name Type Description
elem Object
propName String
Source:
Returns:
Type
Variant

(static) getDisplayed(elem)

Get display style of element.
Parameters:
Name Type Description
elem HTMLElement
Source:
Returns:
(String}

(static) getVisibility(elem)

Get visibility style of element.
Parameters:
Name Type Description
elem HTMLElement
Source:
Returns:
(String}

(static) isDisplayed(elem) → {Bool}

Check if element's CSS display property is not set to 'none'.
Parameters:
Name Type Description
elem HTMLElement
Source:
Returns:
Type
Bool

(static) isShown(elem) → {Bool}

Check if element is likely to be visible on page (only display and visibility style are checked).
Parameters:
Name Type Description
elem HTMLElement
Source:
Returns:
Type
Bool

(static) isVisible(elem) → {Bool}

Check if element's CSS visibility property is not set to 'hidden'.
Parameters:
Name Type Description
elem HTMLElement
Source:
Returns:
Type
Bool

(static) multiplyUnitsValue(value, times) → {String}

Multiple a units string value.
Parameters:
Name Type Description
value String
times Num
Source:
Returns:
Type
String

(static) removeStyleProperty(style, propName)

Remove a property from inline style.
Parameters:
Name Type Description
style Object Inline style object if element.
propName String
Source:

(static) setDisplay(elem, (Variant})

Set display style of element.
Parameters:
Name Type Description
elem HTMLElement
(Variant} value If value is a string, the string will be set to display style. If it is a boolean, display style will be set to 'none'/'' on false/true.
Source:

(static) setVisibility(elem, (Variant})

Set visibility style of element.
Parameters:
Name Type Description
elem HTMLElement
(Variant} value If value is a string, the string will be set to visibility style. If it is a boolean, visibility style will be set to 'hidden'/'' on false/true.
Source: