# Namespace goog.style

code »
Show:Public Protected Private

## Global Functions

code »goog.style.clearTransparentBackgroundImage ( el )

Clears the background image of an element in a browser independent manner.

Parameters

el: `Element`
  The element to clear background image for.

code »`<T>` goog.style.evaluateWithTemporaryDisplay_ ( fn, element ) ⇒ `T`

Call `fn` on `element` such that `element`'s dimensions are accurate when it's passed to `fn`.

Parameters

fn: `function(!Element): T`
  Function to call with `element` as an argument after temporarily changing `element`'s display such that its dimensions are accurate.
element: `!Element`
  Element (which may have display none) to use as argument to `fn`.

Returns

Value returned by calling `fn` with `element`.

code »goog.style.getBackgroundColor ( element ) ⇒ `string`

Retrieves the computed background color string for a given element. The string returned is suitable for assigning to another element's background-color, but is not guaranteed to be in any particular string format. Accessing the color in a numeric form may not be possible in all browsers or with all input. If the background color for the element is defined as a hexadecimal value, the resulting string can be parsed by goog.color.parse in all supported browsers. Whether named colors like "red" or "lightblue" get translated into a format which can be parsed is browser dependent. Calling this function on transparent elements will return "transparent" in most browsers or "rgba(0, 0, 0, 0)" in WebKit.

Parameters

element: `Element`
  The element to get the background color of.

Returns

The computed string value of the background color.

code »goog.style.getBorderBox ( element ) ⇒ `!goog.math.Box`

Gets the computed border widths (on all sides) in pixels

Parameters

element: `Element`
  The element to get the border widths for.

Returns

The computed border widths.

code »goog.style.getBorderBoxSize ( element ) ⇒ `!goog.math.Size`

Gets the border box size for an element.

Parameters

element: `Element`
  The element to get the size for.

Returns

The border box size.

code »goog.style.getBoundingClientRect_ ( el ) ⇒ `Object`

Gets the client rectangle of the DOM element. getBoundingClientRect is part of a new CSS object model draft (with a long-time presence in IE), replacing the error-prone parent offset computation and the now-deprecated Gecko getBoxObjectFor. This utility patches common browser bugs in getBoundingClientRect. It will fail if getBoundingClientRect is unsupported. If the element is not in the DOM, the result is undefined, and an error may be thrown depending on user agent.

Parameters

el: `!Element`
  The element whose bounding rectangle is being queried.

Returns

A native bounding rectangle with numerical left, top, right, and bottom. Reported by Firefox to be of object type ClientRect.

code »goog.style.getBounds ( element ) ⇒ `!goog.math.Rect`

Returns a bounding rectangle for a given element in page space.

Parameters

element: `Element`
  Element to get bounds of. Must not be display none.

Returns

Bounding rectangle for the element.

code »goog.style.getBox_ ( element, stylePrefix ) ⇒ `!goog.math.Box`

Gets the computed paddings or margins (on all sides) in pixels.

Parameters

element: `Element`
  The element to get the padding for.
stylePrefix: `string`
  Pass 'padding' to retrieve the padding box, or 'margin' to retrieve the margin box.

Returns

The computed paddings or margins.

code »goog.style.getCascadedStyle ( element, style ) ⇒ `string`

Gets the cascaded style value of a node, or null if the value cannot be computed (only Internet Explorer can do this).

Parameters

element: `Element`
  Element to get style of.
style: `string`
  Property to get (camel-case).

Returns

Style value.

code »goog.style.getClientLeftTop ( el ) ⇒ `!goog.math.Coordinate`

Returns clientLeft (width of the left border and, if the directionality is right to left, the vertical scrollbar) and clientTop as a coordinate object.

Parameters

el: `Element`
  Element to get clientLeft for.

Returns

Client left and top.

code »goog.style.getClientPosition ( el ) ⇒ `!goog.math.Coordinate`

Returns the position of the event or the element's border box relative to the client viewport.

Parameters

el: `(Element|Event|goog.events.Event)`
  Element or a mouse / touch event.

Returns

The position.

code »goog.style.getClientPositionForElement_ ( el ) ⇒ `!goog.math.Coordinate`

Returns the position of the event or the element's border box relative to the client viewport.

Parameters

el: `!Element`
  Element whose position to get.

Returns

The position.

code »goog.style.getClientViewportElement ( opt_node ) ⇒ `Element`

Returns the viewport element for a particular document

Parameters

opt_node: `Node=`
  DOM node (Document is OK) to get the viewport element of.

Returns

document.documentElement or document.body.

code »goog.style.getComputedBoxSizing ( element ) ⇒ `?string`

Retrieves the computed value of the box-sizing CSS attribute. Browser support: http://caniuse.com/css3-boxsizing.

Parameters

element: `!Element`
  The element whose box-sizing to get.

Returns

'content-box', 'border-box' or 'padding-box'. null if box-sizing is not supported (IE7 and below).

code »goog.style.getComputedCursor ( element ) ⇒ `string`

Retrieves the computed value of the cursor CSS attribute.

Parameters

element: `Element`
  The element to get the cursor of.

Returns

The computed string value of the cursor attribute.

code »goog.style.getComputedOverflowX ( element ) ⇒ `string`

Retrieves the computed value of the overflow-x CSS attribute.

Parameters

element: `Element`
  The element to get the overflow-x of.

Returns

The computed string value of the overflow-x attribute.

code »goog.style.getComputedOverflowY ( element ) ⇒ `string`

Retrieves the computed value of the overflow-y CSS attribute.

Parameters

element: `Element`
  The element to get the overflow-y of.

Returns

The computed string value of the overflow-y attribute.

code »goog.style.getComputedPosition ( element ) ⇒ `string`

Retrieves the computed value of the position CSS attribute.

Parameters

element: `Element`
  The element to get the position of.

Returns

Position value.

code »goog.style.getComputedStyle ( element, property ) ⇒ `string`

Retrieves a computed style value of a node. It returns empty string if the value cannot be computed (which will be the case in Internet Explorer) or "none" if the property requested is an SVG one and it has not been explicitly set (firefox and webkit).

Parameters

element: `Element`
  Element to get style of.
property: `string`
  Property to get (camel-case).

Returns

Style value.

code »goog.style.getComputedTextAlign ( element ) ⇒ `string`

Retrieves the computed value of the text-align CSS attribute.

Parameters

element: `Element`
  The element to get the text-align of.

Returns

The computed string value of the text-align attribute.

code »goog.style.getComputedTransform ( element ) ⇒ `string`

Retrieves the computed value of the CSS transform attribute.

Parameters

element: `Element`
  The element to get the transform of.

Returns

The computed string representation of the transform matrix.

code »goog.style.getComputedZIndex ( element ) ⇒ `(string|number)`

Retrieves the computed value of the z-index CSS attribute.

Parameters

element: `Element`
  The element to get the z-index of.

Returns

The computed value of the z-index attribute.

code »goog.style.getContainerOffsetToScrollInto ( element, container, opt_center ) ⇒ `!goog.math.Coordinate`

Calculate the scroll position of `container` with the minimum amount so that the content and the borders of the given `element` become visible. If the element is bigger than the container, its top left corner will be aligned as close to the container's top left corner as possible.

Parameters

element: `Element`
  The element to make visible.
container: `Element`
  The container to scroll.
opt_center: `boolean=`
  Whether to center the element in the container. Defaults to false.

Returns

The new scroll position of the container, in form of goog.math.Coordinate(scrollLeft, scrollTop).

code »goog.style.getContentBoxSize ( element ) ⇒ `!goog.math.Size`

Gets the content box size for an element. This is potentially expensive in all browsers.

Parameters

element: `Element`
  The element to get the size for.

Returns

The content box size.

code »goog.style.getCssTranslation ( element ) ⇒ `!goog.math.Coordinate`

Returns the x,y translation component of any CSS transforms applied to the element, in pixels.

Parameters

element: `!Element`
  The element to get the translation of.

Returns

The CSS translation of the element in px.

code »goog.style.getFloat ( el ) ⇒ `string`

Gets value of explicitly-set float CSS property on an element.

Parameters

el: `Element`
  The element to get float property of.

Returns

The value of explicitly-set float CSS property on this element.

code »goog.style.getFontFamily ( el ) ⇒ `string`

Returns the font face applied to a given node. Opera and IE should return the font actually displayed. Firefox returns the author's most-preferred font (whether the browser is capable of displaying it or not.)

Parameters

el: `Element`
  The element whose font family is returned.

Returns

The font family applied to el.

code »goog.style.getFontSize ( el ) ⇒ `number`

Returns the font size, in pixels, of text in an element.

Parameters

el: `Element`
  The element whose font size is returned.

Returns

The font size (in pixels).

code »goog.style.getFramedPageOffset ( el, relativeWin ) ⇒ `!goog.math.Coordinate`

Returns a Coordinate object relative to the top-left of an HTML document in an ancestor frame of this element. Used for measuring the position of an element inside a frame relative to a containing frame.

Parameters

el: `Element`
  Element to get the page offset for.
relativeWin: `Window`
  The window to measure relative to. If relativeWin is not in the ancestor frame chain of the element, we measure relative to the top-most window.

Returns

The page offset.

code »goog.style.getIePixelBorder_ ( element, prop ) ⇒ `number`

Helper function for IE to get the pixel border.

Parameters

element: `Element`
  The element to get the pixel border for.
prop: `string`
  The part of the property name.

Returns

The value in pixels.

code »goog.style.getIePixelDistance_ ( element, propName ) ⇒ `number`

Helper function for getting the pixel padding or margin for IE.

Parameters

element: `Element`
  The element to get the padding for.
propName: `string`
  The property name.

Returns

The pixel padding.

code »goog.style.getIePixelValue_ ( element, value, name, pixelName ) ⇒ `number`

IE specific function that converts a non pixel unit to pixels.

Parameters

element: `Element`
  The element to convert the value for.
value: `string`
  The current value as a string. The value must not be ''.
name: `string`
  The CSS property name to use for the converstion. This should be 'left', 'top', 'width' or 'height'.
pixelName: `string`
  The CSS pixel property name to use to get the value in pixels.

Returns

The value in pixels.

code »goog.style.getLengthUnits ( value ) ⇒ `?string`

Returns the units used for a CSS length measurement.

Parameters

value: `string`
  A CSS length quantity.

Returns

The units of measurement.

code »goog.style.getMarginBox ( element ) ⇒ `!goog.math.Box`

Gets the computed margins (on all sides) in pixels.

Parameters

element: `Element`
  The element to get the margins for.

Returns

The computed margins.

code »goog.style.getOffsetParent ( element ) ⇒ `Element`

Returns the first parent that could affect the position of a given element.

Parameters

element: `Element`
  The element to get the offset parent for.

Returns

The first offset parent or null if one cannot be found.

code »goog.style.getOpacity ( el ) ⇒ `(number|string)`

Gets the opacity of a node (x-browser). This gets the inline style opacity of the node, and does not take into account the cascaded or the computed style for this node.

Parameters

el: `Element`
  Element whose opacity has to be found.

Returns

Opacity between 0 and 1 or an empty string `''` if the opacity is not set.

code »goog.style.getPaddingBox ( element ) ⇒ `!goog.math.Box`

Gets the computed paddings (on all sides) in pixels.

Parameters

element: `Element`
  The element to get the padding for.

Returns

The computed paddings.

code »goog.style.getPageOffset ( el ) ⇒ `!goog.math.Coordinate`

Returns a Coordinate object relative to the top-left of the HTML document. Implemented as a single function to save having to do two recursive loops in opera and safari just to get both coordinates. If you just want one value do use goog.style.getPageOffsetLeft() and goog.style.getPageOffsetTop(), but note if you call both those methods the tree will be analysed twice.

Parameters

el: `Element`
  Element to get the page offset for.

Returns

The page offset.

code »goog.style.getPageOffsetLeft ( el ) ⇒ `number`

Returns the left coordinate of an element relative to the HTML document

Parameters

el: `Element`
  Elements.

Returns

The left coordinate.

code »goog.style.getPageOffsetTop ( el ) ⇒ `number`

Returns the top coordinate of an element relative to the HTML document

Parameters

el: `Element`
  Elements.

Returns

The top coordinate.

code »goog.style.getPixelStyleValue_ ( value, round ) ⇒ `string`

Helper function to create a string to be set into a pixel-value style property of an element. Can round to the nearest integer value.

Parameters

value: `(string|number)`
  The style value to be used. If a number, 'px' will be appended, otherwise the value will be applied directly.
round: `boolean`
  Whether to round the nearest integer (if property is a number).

Returns

The string value for the property.

code »goog.style.getPosition ( element ) ⇒ `!goog.math.Coordinate`

Gets the offsetLeft and offsetTop properties of an element and returns them in a Coordinate object

Parameters

element: `Element`
  Element.

Returns

The position.

code »goog.style.getRelativePosition ( a, b ) ⇒ `!goog.math.Coordinate`

Returns the position of an element relative to another element in the document. A relative to B

Parameters

a: `(Element|Event|goog.events.Event)`
  Element or mouse event whose position we're calculating.
b: `(Element|Event|goog.events.Event)`
  Element or mouse event position is relative to.

Returns

The relative position.

code »goog.style.getScrollbarWidth ( opt_className ) ⇒ `number`

Returns the scroll bar width (represents the width of both horizontal and vertical scroll).

Parameters

opt_className: `string=`
  An optional class name (or names) to apply to the invisible div created to measure the scrollbar. This is necessary if some scrollbars are styled differently than others.

Returns

The scroll bar width in px.

code »goog.style.getSize ( element ) ⇒ `!goog.math.Size`

Gets the height and width of an element, even if its display is none. Specifically, this returns the height and width of the border box, irrespective of the box model in effect. Note that this function does not take CSS transforms into account. Please see `goog.style.getTransformedSize`.

Parameters

element: `Element`
  Element to get size of.

Returns

Object with width/height properties.

code »goog.style.getSizeWithDisplay_ ( element ) ⇒ `!goog.math.Size`

Gets the height and width of an element when the display is not none.

Parameters

element: `Element`
  Element to get size of.

Returns

Object with width/height properties.

code »goog.style.getStyle ( element, property ) ⇒ `string`

Retrieves an explicitly-set style value of a node. This returns '' if there isn't a style attribute on the element or if this style property has not been explicitly set in script.

Parameters

element: `Element`
  Element to get style of.
property: `string`
  Property to get, css-style (if you have a camel-case property, use element.style[style]).

Returns

Style value.

code »goog.style.getStyle_ ( element, style ) ⇒ `string`

Cross-browser pseudo get computed style. It returns the computed style where available. If not available it tries the cascaded style value (IE currentStyle) and in worst case the inline style value. It shouldn't be called directly, see http://wiki/Main/ComputedStyleVsCascadedStyle for discussion.

Parameters

element: `Element`
  Element to get style of.
style: `string`
  Property to get (must be camelCase, not css-style.).

Returns

Style value.

code »goog.style.getTransformedSize ( element ) ⇒ `goog.math.Size`

Gets the height and width of an element, post transform, even if its display is none. This is like `goog.style.getSize`, except:

1. Takes webkitTransforms such as rotate and scale into account.
2. Will return null if `element` doesn't respond to `getBoundingClientRect`.
3. Currently doesn't make sense on non-WebKit browsers which don't support webkitTransforms.

Parameters

element: `!Element`
  Element to get size of.

Returns

Object with width/height properties.

code »goog.style.getVendorJsStyleName_ ( element, style ) ⇒ `string`

Returns the style property name in camel-case. If it does not exist and a vendor-specific version of the property does exist, then return the vendor- specific property name instead.

Parameters

element: `Element`
  The element to change.
style: `string`
  Style name.

Returns

Vendor-specific style.

code »goog.style.getVendorStyleName_ ( element, style ) ⇒ `string`

Returns the style property name in CSS notation. If it does not exist and a vendor-specific version of the property does exist, then return the vendor- specific property name instead.

Parameters

element: `Element`
  The element to change.
style: `string`
  Style name.

Returns

Vendor-specific style.

code »goog.style.getViewportPageOffset ( doc ) ⇒ `!goog.math.Coordinate`

Calculates the viewport coordinates relative to the page/document containing the node. The viewport may be the browser viewport for non-iframe document, or the iframe container for iframe'd document.

Parameters

doc: `!Document`
  The document to use as the reference point.

Returns

The page offset of the viewport.

code »goog.style.getVisibleRectForElement ( element ) ⇒ `goog.math.Box`

Calculates and returns the visible rectangle for a given element. Returns a box describing the visible portion of the nearest scrollable offset ancestor. Coordinates are given relative to the document.

Parameters

element: `Element`
  Element to get the visible rect for.

Returns

Bounding elementBox describing the visible rect or null if scrollable ancestor isn't inside the visible viewport.

code »goog.style.installStyles ( stylesString, opt_node ) ⇒ `(Element|StyleSheet)`

Installs the styles string into the window that contains opt_element. If opt_element is null, the main window is used.

Parameters

stylesString: `string`
  The style string to install.
opt_node: `Node=`
  Node whose parent document should have the styles installed.

Returns

The style element created.

code »goog.style.isElementShown ( el ) ⇒ `boolean`

Test whether the given element has been shown or hidden via a call to `#setElementShown`. Note this is strictly a companion method for a call to `#setElementShown` and the same caveats apply; in particular, this method does not guarantee that the return value will be consistent with whether or not the element is actually visible.

Parameters

el: `Element`
  The element to test.

Returns

Whether the element has been shown.

code »goog.style.isRightToLeft ( el ) ⇒ `boolean`

Returns true if the element is using right to left (rtl) direction.

Parameters

el: `Element`
  The element to test.

Returns

True for right to left, false for left to right.

code »goog.style.isUnselectable ( el ) ⇒ `boolean`

Returns true if the element is set to be unselectable, false otherwise. Note that on some platforms (e.g. Mozilla), even if an element isn't set to be unselectable, it will behave as such if any of its ancestors is unselectable.

Parameters

el: `Element`
  Element to check.

Returns

Whether the element is set to be unselectable.

code »goog.style.parseStyleAttribute ( value ) ⇒ `!Object`

Parses a style attribute value. Converts CSS property names to camel case.

Parameters

value: `string`
  The style attribute value.

Returns

Map of CSS properties to string values.

code »goog.style.scrollIntoContainerView ( element, container, opt_center )

Changes the scroll position of `container` with the minimum amount so that the content and the borders of the given `element` become visible. If the element is bigger than the container, its top left corner will be aligned as close to the container's top left corner as possible.

Parameters

element: `Element`
  The element to make visible.
container: `Element`
  The container to scroll.
opt_center: `boolean=`
  Whether to center the element in the container. Defaults to false.

code »goog.style.setBorderBoxSize ( element, size )

Sets the border box size of an element. This is potentially expensive in IE if the document is CSS1Compat mode

Parameters

element: `Element`
  The element to set the size on.
size: `goog.math.Size`
  The new size.

code »goog.style.setBoxSizingSize_ ( element, size, boxSizing )

Helper function that sets the box sizing as well as the width and height

Parameters

element: `Element`
  The element to set the size on.
size: `goog.math.Size`
  The new size to set.
boxSizing: `string`
  The box-sizing value.

code »goog.style.setContentBoxSize ( element, size )

Sets the content box size of an element. This is potentially expensive in IE if the document is BackCompat mode.

Parameters

element: `Element`
  The element to set the size on.
size: `goog.math.Size`
  The new size.

code »goog.style.setElementShown ( el, isShown )

Shows or hides an element from the page. Hiding the element is done by setting the display property to "none", removing the element from the rendering hierarchy so it takes up no space. To show the element, the default inherited display property is restored (defined either in stylesheets or by the browser's default style rules). Caveat 1: if the inherited display property for the element is set to "none" by the stylesheets, that is the property that will be restored by a call to setElementShown(), effectively toggling the display between "none" and "none". Caveat 2: if the element display style is set inline (by setting either element.style.display or a style attribute in the HTML), a call to setElementShown will clear that setting and defer to the inherited style in the stylesheet.

Parameters

el: `Element`
  Element to show or hide.
isShown: `*`
  True to render the element in its default style, false to disable rendering the element.

code »goog.style.setFloat ( el, value )

Sets CSS float property on an element.

Parameters

el: `Element`
  The element to set float property on.
value: `string`
  The value of float CSS property to set on this element.

code »goog.style.setHeight ( element, height )

Set the height of an element. Sets the element's style property.

Parameters

element: `Element`
  Element to set the height of.
height: `(string|number)`
  The height value to set. If a number, 'px' will be appended, otherwise the value will be applied directly.

code »goog.style.setInlineBlock ( el )

Sets 'display: inline-block' for an element (cross-browser).

Parameters

el: `Element`
  Element to which the inline-block display style is to be applied.

code »goog.style.setOpacity ( el, alpha )

Sets the opacity of a node (x-browser).

Parameters

el: `Element`
  Elements whose opacity has to be set.
alpha: `(number|string)`
  Opacity between 0 and 1 or an empty string `''` to clear the opacity.

code »goog.style.setPageOffset ( el, x, opt_y )

Moves an element to the given coordinates relative to the client viewport.

Parameters

el: `Element`
  Absolutely positioned element to set page offset for. It must be in the document.
x: `(number|goog.math.Coordinate)`
  Left position of the element's margin box or a coordinate object.
opt_y: `number=`
  Top position of the element's margin box.

code »goog.style.setPosition ( el, arg1, opt_arg2 )

Sets the top/left values of an element. If no unit is specified in the argument then it will add px. The second argument is required if the first argument is a string or number and is ignored if the first argument is a coordinate.

Parameters

el: `Element`
  Element to move.
arg1: `(string|number|goog.math.Coordinate)`
  Left position or coordinate.
opt_arg2: `(string|number)=`
  Top position.

code »goog.style.setPreWrap ( el )

Sets 'white-space: pre-wrap' for a node (x-browser). There are as many ways of specifying pre-wrap as there are browsers. CSS3/IE8: white-space: pre-wrap; Mozilla: white-space: -moz-pre-wrap; Opera: white-space: -o-pre-wrap; IE6/7: white-space: pre; word-wrap: break-word;

Parameters

el: `Element`
  Element to enable pre-wrap for.

code »goog.style.setSize ( element, w, opt_h )

Sets the width/height values of an element. If an argument is numeric, or a goog.math.Size is passed, it is assumed to be pixels and will add 'px' after converting it to an integer in string form. (This just sets the CSS width and height properties so it might set content-box or border-box size depending on the box model the browser is using.)

Parameters

element: `Element`
  Element to set the size of.
w: `(string|number|goog.math.Size)`
  Width of the element, or a size object.
opt_h: `(string|number)=`
  Height of the element. Required if w is not a size object.

code »goog.style.setStyle ( element, style, opt_value )

Sets a style value on an element. This function is not indended to patch issues in the browser's style handling, but to allow easy programmatic access to setting dash-separated style properties. An example is setting a batch of properties from a data object without overwriting old styles. When possible, use native APIs: elem.style.propertyKey = 'value' or (if obliterating old styles is fine) elem.style.cssText = 'property1: value1; property2: value2'.

Parameters

element: `Element`
  The element to change.
style: `(string|Object)`
  If a string, a style name. If an object, a hash of style names to style values.
opt_value: `(string|number|boolean)=`
  If style was a string, then this should be the value.

code »goog.style.setStyle_ ( element, value, style )

Sets a style value on an element, with parameters swapped to work with `goog.object.forEach()`. Prepends a vendor-specific prefix when necessary.

Parameters

element: `Element`
  The element to change.
value: `(string|number|boolean|undefined)`
  Style value.
style: `string`
  Style name.

code »goog.style.setStyles ( element, stylesString )

Sets the content of a style element. The style element can be any valid style element. This element will have its content completely replaced by the new stylesString.

Parameters

element: `(Element|StyleSheet)`
  A stylesheet element as returned by installStyles.
stylesString: `string`
  The new content of the stylesheet.

code »goog.style.setTransparentBackgroundImage ( el, src )

Sets the background of an element to a transparent image in a browser- independent manner. This function does not support repeating backgrounds or alternate background positions to match the behavior of Internet Explorer. It also does not support sizingMethods other than crop since they cannot be replicated in browsers other than Internet Explorer.

Parameters

el: `Element`
  The element to set background on.
src: `string`
  The image source URL.

code »goog.style.setUnselectable ( el, unselectable, opt_noRecurse )

Makes the element and its descendants selectable or unselectable. Note that on some platforms (e.g. Mozilla), even if an element isn't set to be unselectable, it will behave as such if any of its ancestors is unselectable.

Parameters

el: `Element`
  The element to alter.
unselectable: `boolean`
  Whether the element and its descendants should be made unselectable.
opt_noRecurse: `boolean=`
  Whether to only alter the element's own selectable state, and leave its descendants alone; defaults to false.

code »goog.style.setWidth ( element, width )

Set the width of an element. Sets the element's style property.

Parameters

element: `Element`
  Element to set the width of.
width: `(string|number)`
  The width value to set. If a number, 'px' will be appended, otherwise the value will be applied directly.

code »goog.style.showElement ( el, display )
Deprecated: Use goog.style.setElementShown instead.

Shows or hides an element from the page. Hiding the element is done by setting the display property to "none", removing the element from the rendering hierarchy so it takes up no space. To show the element, the default inherited display property is restored (defined either in stylesheets or by the browser's default style rules.) Caveat 1: if the inherited display property for the element is set to "none" by the stylesheets, that is the property that will be restored by a call to showElement(), effectively toggling the display between "none" and "none". Caveat 2: if the element display style is set inline (by setting either element.style.display or a style attribute in the HTML), a call to showElement will clear that setting and defer to the inherited style in the stylesheet.

Parameters

el: `Element`
  Element to show or hide.
display: `*`
  True to render the element in its default style, false to disable rendering the element.

code »goog.style.toCamelCase ( selector ) ⇒ `string`
Deprecated: Use goog.string.toCamelCase instead.

Converts a CSS selector in the form style-property to styleProperty.

Parameters

selector: `*`
  CSS Selector.

Returns

Camel case selector.

code »goog.style.toSelectorCase ( selector ) ⇒ `string`
Deprecated: Use goog.string.toSelectorCase instead.

Converts a CSS selector in the form styleProperty to style-property.

Parameters

selector: `string`
  Camel case selector.

Returns

Selector cased.

code »goog.style.toStyleAttribute ( obj ) ⇒ `string`

Reverse of parseStyleAttribute; that is, takes a style object and returns the corresponding attribute value. Converts camel case property names to proper CSS selector names.

Parameters

obj: `Object`
  Map of CSS properties to values.

Returns

The style attribute value.

code »goog.style.translateRectForAnotherFrame ( rect, origBase, newBase )

Translates the specified rect relative to origBase page, for newBase page. If origBase and newBase are the same, this function does nothing.

Parameters

rect: `goog.math.Rect`
  The source rectangle relative to origBase page, and it will have the translated result.
origBase: `goog.dom.DomHelper`
  The DomHelper for the input rectangle.
newBase: `goog.dom.DomHelper`
  The DomHelper for the resultant coordinate. This must be a DOM for an ancestor frame of origBase or the same as origBase.

code »goog.style.uninstallStyles ( styleSheet )

Removes the styles added by `#installStyles`.

Parameters

styleSheet: `(Element|StyleSheet)`
  The value returned by `#installStyles`.

## Global Properties

code »goog.style.ABSOLUTE_CSS_LENGTH_UNITS_ : `Object`

Map of absolute CSS length units

code »goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_ : `Object`

Map of relative CSS length units that can be accurately converted to px font-size values using getIePixelValue_. Only units that are defined in relation to a font size are convertible (%, small, etc. are not).

code »goog.style.MATRIX_TRANSLATION_REGEX_ : `!RegExp`

Regular expression to extract x and y translation components from a CSS transform Matrix representation.

code »goog.style.ieBorderWidthKeywords_ : `Object`

A map used to map the border width keywords to a pixel width.

code »goog.style.lengthUnitRegex_ : `RegExp`

Regular expression used for getLengthUnits.

code »goog.style.unselectableStyle_ : `?string`

The CSS style property corresponding to an element being unselectable on the current browser platform (null if none). Opera and IE instead use a DOM attribute 'unselectable'.

## Compiler Constants

code »goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS : `boolean`