The goog.editor.style Namespace

.getContainer(node)

Return the first ancestor of this node that is a container, inclusive.

node {Node}
Node to find the container of.
returns {Element}
The element which contains node.
@see
isContainer

.isContainer(element)

Returns true if the element is a container of other non-inline HTML Note that span, strong and em tags, being inline can only contain other inline elements and are thus, not containers. Containers are elements that should not be broken up when wrapping selections with a node of an inline block styling.

element {Node}
The element to check.
returns {boolean}
Whether the element is a container.

.isDisplayBlock(node)

Checks whether the given element inherits display: block.

node {Node}
The Node to check.
returns {boolean}
Whether the element inherits CSS display: block.

.makeSelectable(element)

Make the given element selectable. For IE this simply turns off the "unselectable" property. Under FF no descendent of an unselectable node can be selectable: https://bugzilla.mozilla.org/show_bug.cgi?id=203291 So we make each ancestor of node selectable, while trying to preserve the unselectability of other nodes along that path This may cause certain text nodes which should be unselectable, to become selectable. For example:

Text1 Text2
If we call makeSelectable on span1, then it will cause "Text1" to become selectable, since it had to make div1 selectable in order for span1 to be selectable. If "Text1" were enclosed within a

or , then this problem would not arise. Text nodes do not have styles, so its style can't be set to unselectable.

element {Element}
The element to make selectable.

.makeUnselectable(element, eventHandler)

Makes the given element unselectable, as well as all of its children, except for text areas, text, file and url inputs.

element {Element}
The element to make unselectable.
eventHandler {goog.events.EventHandler}
An EventHandler to register the event with. Assumes when the node is destroyed, the eventHandler's listeners are destroyed as well.