addCssClass()chooseCssClass()eltGetAncestorByTag()eltOuterHeight()eltOuterWidth()eltTransition()evtGetPointerX()evtGetPointerY()getElt()hasCssClass()hasElt()isDomNode()replaceCssClass()The DOM functions manipulate DOM elements. All DOM functions are properties of the global/window object and may be used without importing.
addCssClass() addCssClass(arg1, ...classNames)
Adds CSS classes to an element, object, or string. The arguments in classNames are strings of class names separated by spaces.
If arg1 is a string, it is considered to be class names separated by spaces, and the class names in the classNames arguments are added to arg1 if they don't exist. The resulting string of class names is returned.
If arg1 is an object or DOM element, then the class names in the classNames arguments are added to the class names in arg1.className if they don't exist. If arg1.className does not exist, then arg1.className is set to the class names in the classNames arguments with any duplicates removed.
arg1className property should contain zero or more CSS class names separated by spaces, if present. classNamesclassNames arguments are strings containing zero or more CSS class names separated by spaces.If arg1 is a string, then a string is returned containing all the CSS classes specified in the arguments without duplicates. If arg1 is a DOM element or object, then undefined is returned.
chooseCssClass() chooseCssClass(arg1, choice, ...choices)
Adds a single choice of CSS class name to the string, object, or DOM element specified by arg1. All the remaining choices are removed. The choice argument is an index into the choices arguments. This is useful when a CSS class string must have one of several different class names but not more than one.
arg1className property should contain zero or more CSS class names separated by spaces, if present. classNamesclassNames arguments are strings containing zero or more CSS class names separated by spaces.If arg1 is a string, then a string is returned containing all the CSS classes with the chosen class names, with the others removed. If arg1 is a DOM element or object, then undefined is returned.
eltGetAncestorByTag() eltGetAncestorByTag(elt, tag)
Return the enclosing element with the given tag. For example, eltGetAncestorByTag(elt, 'tr') returns the enclosing table row.
elttagA DOM element, if the tag is found, or null otherwise.
eltOuterHeight() eltOuterHeight(elt)
Returns the height of the element's bounding box in pixels (px units).
eltA number.
eltOuterWidth() eltOuterWidth(elt)
Returns the width of the element's bounding box in pixels (px units).
eltA number.
eltTransition() Returns a Promise that resolves when the transition is complete.elt, startFn)
Asynchronously set up a transition on a DOM element.
startFn is a function that is called asynchronously when the current thread completes. This allows eltTransition() to be called before the element is fully painted with it's current style. At that point, the startFn can set up a transition or a new CSS class with a transition. The startFn is passed the DOM element as its single argument.
eltTransition() returns a Promise that resolves when the transition is complete.
eltstartFnstartFn(elt) where elt is the DOM element referenced by the eltTransition() elt argument. startFn() should set up the element with the new transition either by changing style or CSS class name.A Promise that resolves when the transition is complete.
evtGetPointerX() evtGetPointerX(evt)
Returns the client X offset in pixels from the evt event object. On touch devices it returns the first touch point's X offset.
evtA number.
evtGetPointerY() evtGetPointerY(evt)
Returns the client Y offset in pixels from the evt event object. On touch devices it returns the first touch point's Y offset.
evtA number.
getElt() getElt(id)
Returns the DOM element whose ID string is id. getElt() generates an assertion failure if the ID is not found.
idA DOM element.
hasCssClass() hasCssClass(arg1, className)
Return true if the DOM element, object, or string contains the string className.
If arg1 is a string, it is considered to be class names separated by spaces, and hasCssClass() returns true if the string includes className. It returns false if className is not present.
If arg1 is an object or DOM element, then hasCssClass() returns true if arg1.className includes className. It returns false if className is not present or arg1.className does not exist.
arg1className property should contain zero or more CSS class names separated by spaces, if present. classNameA Boolean
hasElt() hasElt(id)
Returns true if the DOM element whose ID string is id exists.
idA Boolean.
isDomNode() isDomNode(arg)
Returns true if arg is a DOM element.
argA Boolean.
replaceCssClass() replaceCssClass(arg1, oldClass)
replaceCssClass(arg1, oldClass, newClass)
Deletes the CSS classes in oldClass and adds the CSS classes in newClass to the element, object, or string specified by arg1. If newClass is not provided, then the oldClass classes are deleted.
If arg1 is a string, it is considered to be class names separated by spaces, and the class names in oldClass are deleted, and the class names in the newClass are added if they don't exist. The resulting string of class names is returned.
If arg1 is an object or DOM element, then the class names in oldClass are deleted from arg1.className, and the class names in the newClass are added to arg1.className, if they don't exist. If arg1.className does not exist, then arg1.className is set to the class names in the newClass argument with any duplicates removed.
arg1className property should contain zero or more CSS class names separated by spaces, if present. oldClassnewClass (opional)If arg1 is a string, then a string is returned containing the result of deleting and adding the specified classes to the original string without duplicates. If arg1 is a DOM element or object, then undefined is returned.