TinyMCE:API/tinymce.dom.DOMUtils

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Class: tinymce.dom.DOMUtils

Utility class for various DOM manipulation and retrival functions.

Examples

// Add a class to an element by id in the page
tinymce.DOM.addClass('someid', 'someclass')

// Add a class to an element by id inside the editor
tinyMCE.activeEditor.dom.addClass('someid', 'someclass')

Constructor

DOMUtils
Constructs a new DOMUtils instance.

Methods

add
Adds the specified element to another element or elements.
addClass
Adds a class to the specified element or elements.
create
Creates a new element.
createHTML
Create HTML string for element.
createRng
Creates a W3C compatible DOM Range on all browsers.
decode
Entity decode a string, resolves any HTML entities like å.
encode
Entity encodes a string, encodes the most common entities <>"& into entities.
get
Returns the specified element by ID or the input element if it isn't a string.
getAttrib
Returns the specified attribute by name.
getClasses
Returns a array of all single CSS classes in the document.
getOuterHTML
Returns the outer HTML of an element.
getParent
Returns a node by the specified selector function.
getParents
Returns a node list of parents.
getPos
Returns the absolute x, y position of a node.
getRect
Returns the rectangle for a specific element.
getRoot
Returns the root node of the document this is normally the body but might be a DIV.
getStyle
Returns the current style or runtime/computed value of a element.
getViewPort
Returns the viewport of the window.
hasClass
Returns true if the specified element has the specified class.
hide
Hides the specified element(s) by ID by setting the "display" style.
insertAfter
Inserts a element after the reference element.
is
Returns true/false node matches the CSS expression.
isBlock
Returns true/false if the specified element is a block element or not.
isHidden
Returns true/false if the element is hidden or not by checking the "display" style.
loadCSS
Imports/loads the specified CSS file into the document bound to the class.
parseStyle
Parses the specified style value into an object collection.
processHTML
Processes the HTML by replacing strong, em, del in gecko since it doesn't support them properly in a RTE environment.
remove
Removes/deletes the specified element(s) from the DOM.
removeClass
Removes a class from the specified element or elements.
replace
Replaces the specified element or elements with the specified element, the new element will be cloned if multiple inputs elements are passed.
run
Executes the specified function on the element by id or dom element node or array of elements/id.
select
Selects specific elements by a CSS level 3 pattern.
serializeStyle
Serializes the specified style object into a string.
setAttrib
Sets the specified attributes value of a element or elements.
setAttribs
Sets the specified attributes of a element or elements.
setHTML
Sets the specified HTML content inside the element or elements.
setOuterHTML
Sets the specified outer HTML on a element or elements.
setStyle
Sets the CSS style value on a HTML element.
setStyles
Sets multiple styles on the specified element(s).
show
Shows the specified element(s) by ID by setting the "display" style.
split
Splits an element into two new elements and places the specified split element or element between the new ones.
toHex
Parses the specified RGB color value and returns a hex version of that color.
uniqueId
Returns a unique id.
Personal tools