DOM.js is a lightweight, fast cross browser library for DOM traversal, manipulation and event handling.
Only 3KB compressed and gzipped!
Some of the topics contains performance tests (vs jquery). I will be adding them as soon as possible.
DOM traversal
DOM manipulation
Event handling
clickdblclickmouseovermouseoutmousedownmouseupmouseentermouseleavemousemovefocusblurselectchangesubmitresetkeydownkeyupkeypressselector)Finds HTMLElements that match css pattern.
Supported from IE 8.0, FF 3.5, Chrome 4.0, Safari 3.1
selector css seletor eg.(ul > li)id)Returns HTMLElement with given id
id element's idtagName)Finds HTMLElements that match given tag name
tagName tag's name eg.(a, span, div, etc)className)Finds HTMLElements that match given class name
Supported from IE 8.0, FF 3.5, Chrome 4.0, Safari 3.1
className css class nameelement)Gets the parent of the html element
element html elementelement, tag)Gets children elements of the html element
element html elementtag determines whether text nodes should be returned or tells function to filter children by tagnameelement)Gets following sibling element of the HTMLElement
element html elementelement)Gets previous sibling element of the HTMLElement
element html elementelement, attribute)Gets or sets element's attribute(s) if the attribute(s) is not defined this method returns an empty string
element html elementattribute attribute name, array of attribute names or objectelement, style)Sets or gets HTMLElement's style
element html elementstyle css property name, array of css properties or objectelement)Gets css classes of the given element
element html elementelement|nodeList|Array, className)Assignes css class(es) to the html element(s)
element html element or array of elementsclassName class(es) that will be assigned to the elementelement, className)Checks whether html element is assigned to the given class(es)
element html element or array of elementsclassName class that function will check againstelement|nodeList|Array, className)Removes html element's assignment to the css class(es)
element html element or array of elementsclassName class(es) that will be removed from the element's class attributehtml)Creates and returns html element created from provided content
html html stringelement)Creates a copy of a node, and returns the clone.
element html elementelement html)Gets or sets inner html of HTMLElement
element html elementhtml html stringelement, text)Gets or sets text value of the HTML element
element html elementtext text stringelement, html)Inserts content specified by the html argument at the end of HTMLElement
element html elementhtml html string or element that will be insertedelement, html)Inserts content specified by the html argument at the beginning of HTMLElement
element html elementhtml html string or element that will be insertedelement, html)Inserts content specified by the html argument after the HTMLElement
element html element after which html content will be placedhtml html string or element that will be insertedelement, html)Inserts content specified by the html argument before the HTMLElement
element html element before which html content will be placedhtml html string or element that will be insertedelement, html)Replaces given html element with content specified in html parameter
element html element that will be replacedhtml html string or element that will be insertedelement)Removes HTMLElement from dom tree
element html element that will be removedhtml string containings element's htmlclassName class(es) that will be removed from the element's class attributeelement|nodeList|Array, event, listener)Attaches javascript listener to the element(s) for the given event type.
element a DOMElement, NodeList or just an array with DOMElementsevent a dom event name, eg. (click, dblclick, etc.)listener a javascript function wich will be called when given event occursDom.js also offers aliases for Dom.addListener function.
You can check list of aliases, explanation and event names here.
element|nodeList|Array, event, listener)Removes javascript listener from the element(s) for the given event type.
element a DOMElement, NodeList or just an array with DOMElementsevent a dom event name, eg. (click, dblclick, etc.)listener a javascript function wich will be called when given event occurselement|nodeList|Array, event, options)Execute all handlers and behaviors attached to the element(s) for the given event type
element a DOMElement, NodeList or just an array with DOMElementsevent a dom event name, eg. (click, dblclick, etc.)options event options object eg. (screenX, screenY, etc.)element, event, listener)Determine whether a supplied listener is attached to the element
element a DOMElement, NodeList or just an array with DOMElementsevent a dom event name, eg. (click, dblclick, etc.)listener a javascript callback functionclick Dom.onClick(element|nodeList|Array, listener)A pointing device button has been pressed and released on an element.
dblclick Dom.onDblClick(element|nodeList|Array, listener)A pointing device button is clicked twice on an element.
mouseover Dom.onMouseOver(element|nodeList|Array, listener)A pointing device is moved onto the element that has the listener attached or onto one of its children.
mouseout Dom.onMouseOut(element|nodeList|Array, listener)A pointing device is moved off the element that has the listener attached or off one of its children.
mousedown Dom.onMouseOut(element|nodeList|Array, listener)A pointing device button (usually a mouse) is pressed on an element.
mouseup Dom.onMouseUp(element|nodeList|Array, listener)A pointing device button is released over an element.
mouseenter Dom.onMouseEnter(element|nodeList|Array, listener)A pointing device is moved onto the element that has the listener attached.
mouseleave Dom.onMouseLeave(element|nodeList|Array, listener)A pointing device is moved off the element that has the listener attached.
mousemove Dom.onMouseMove(element|nodeList|Array, listener)A pointing device is moved over an element.
focus Dom.onFocus(element|nodeList|Array, listener)An element has received focus (does not bubble).
blur Dom.onBlur(element|nodeList|Array, listener)An element has lost focus (does not bubble).
select Dom.onSelect(element|nodeList|Array, listener)Some text is input being selected.
change Dom.onChange(element|nodeList|Array, listener)An element loses focus and its value changed since gaining focus.
submit Dom.onSubmitelement|nodeList|Array, listener)A form is submitted.
reset Dom.onReset(element|nodeList|Array, listener)A form is reset.
keydown Dom.onKeyDown(element|nodeList|Array, listener)A key is pressed down.
keyup Dom.onKeyUp(element|nodeList|Array, listener)A key is released.
keypress Dom.onKeyPress(element|nodeList|Array, listener)A key is pressed down and that key normally produces a character value (use input instead).
drag Dom.onDrag(element|nodeList|Array, listener)An element or text selection is being dragged (every 350ms).
dragstart Dom.onDragStart(element|nodeList|Array, listener)The user starts dragging an element or text selection.
dragend Dom.onDragEnd(element|nodeList|Array, listener)A drag operation is being ended (by releasing a mouse button or hitting the escape key).
load Dom.onLoad(element|nodeList|Array, listener)A resource and its dependent resources have finished loading.
scroll Dom.onScroll(element|nodeList|Array, listener)The document view or an element has been scrolled.
unload Dom.onUnload(element|nodeList|Array, listener)The document or a dependent resource is being unloaded.
resize Dom.onResize(element|nodeList|Array, listener)The document view has been resized.
$ claude mcp add dom.js \
-- python -m otcore.mcp_server <graph>