new H_dom()
dom.js, line 28
Methods
-
staticH_dom.add_class(dom_element, class_name)
dom.js, line 620 -
Adds a class to a DOM element.
Name Type Description dom_elementHTMLElement The element. class_namestring Class name. -
staticH_dom.add_css_rule(sheet_id, selector, style, sheet_media){number|false}
dom.js, line 1647 -
Adds a CSS rule to a stylesheet.
Name Type Description sheet_idint Stylesheet ID. selectorstring CSS selector. stylestring CSS style. sheet_mediaobject Media condition. Returns:
Type Description number | false Rule index or false. -
staticH_dom.add_script_tag(script_tag, delay)
dom.js, line 120 -
Adds a script tag to the DOM, handling defer if present.
Name Type Description script_tagHTMLElement The script tag element. delaynumber Optional delay for deferred script_tag. -
staticH_dom.append_content(dom_element, content)
dom.js, line 516 -
Appends content to a DOM element.
Handles DOM elements, arrays, objects, and strings.
or an object/class who got an attribute dom_element that point to a dom elementName Type Description dom_elementHTMLElement Target element. content* Content to append. -
staticH_dom.can_have_css(dom_element){boolean}
dom.js, line 596 -
Checks if a DOM element can have CSS classes. classList exist.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description boolean True if can have CSS. -
staticH_dom.clone_dom_element(dom_element, recursive){HTMLElement}
dom.js, line 570 -
Clones a DOM element, optionally recursively.
Copies event listeners and custom classes.Name Type Description dom_elementHTMLElement Element to clone. recursiveboolean Clone children. Returns:
Type Description HTMLElement The cloned element. -
staticH_dom.create_button_info(params, content}, type){SVGElement}
dom.js, line 490 -
Creates an button info element.
Name Type Default Description paramsobject {} optional attributes. content}object optional content of the tooltip. typestring 'text' optional type of content (text or link). Returns:
Type Description SVGElement The SVG icon element. -
staticH_dom.create_element(tag_name, params, content, parent){HTMLElement}
dom.js, line 404 -
Creates a new DOM or SVG element with attributes and content.
and add it to the targetted parent?Name Type Description tag_namestring Tag name. paramsobject optional Attributes. content* optional Content to append. parentHTMLElement optional Parent to append to. Returns:
Type Description HTMLElement The created element. -
staticH_dom.create_icon(name, params){SVGElement}
dom.js, line 476 -
Creates an SVG icon element.
Name Type Default Description namestring Icon name. paramsobject {} optional SVG attributes. Returns:
Type Description SVGElement The SVG icon element. -
staticH_dom.disable_css_sheet(sheet_id){boolean}
dom.js, line 1685 -
Disables a CSS stylesheet by ID.
Name Type Description sheet_idint Stylesheet ID. Returns:
Type Description boolean True if disabled. -
staticH_dom.disable_mouse_events(dom_element)
dom.js, line 1755 -
Disables mouse events on a DOM element.
Name Type Description dom_elementHTMLElement The element. -
staticH_dom.enable_css_sheet(sheet_id){boolean}
dom.js, line 1709 -
Enables a CSS stylesheet by ID.
Name Type Description sheet_idint Stylesheet ID. Returns:
Type Description boolean True if enabled. -
staticH_dom.enable_mouse_events(dom_element)
dom.js, line 1768 -
Enables mouse events on a DOM element.
Name Type Description dom_elementHTMLElement The element. -
staticH_dom.find_child_index(parent_element, child_element){number}
dom.js, line 361 -
Finds the index of a child element.
Name Type Description parent_elementHTMLElement Parent element. child_elementHTMLElement Child element. Returns:
Type Description number Index or -1 if not found. -
staticH_dom.get_css_rules(sheet_id, sheet_media){object|false}
dom.js, line 1614 -
Gets the cssRulesList of a stylesheet or CSSMediaRule.
Both implement insertRule and removeRule methods.Name Type Description sheet_idint Stylesheet ID. sheet_mediaobject Media condition. Returns:
Type Description object | false CSS stylesheet or rule. -
staticH_dom.get_document_scroll(axis){number}
dom.js, line 925 -
Returns the scroll offset of the document along one axis.
Browsers do not agree on which element carries the scroll of the page: the expression walks documentElement, then body, and keeps the first one that exposes a number. Used by set_global_position() and set_global_axis() for fixed elements.Name Type Description axisstring 'x' or 'y'. Returns:
Type Description number Scroll offset in px. -
staticH_dom.get_dom_element(dom_id_or_object){HTMLElement|null}
dom.js, line 375 -
Gets a DOM element by ID or returns the dom object.
Name Type Description dom_id_or_objectstring | object ID or element. Returns:
Type Description HTMLElement | null The DOM element or null. -
staticH_dom.get_em_unit_value(parent_node){number}
dom.js, line 1822 -
Gets the value of 1em in pixels for a parent node.
Name Type Description parent_nodeHTMLElement Parent node. Returns:
Type Description number Value of 1em in px. -
staticH_dom.get_global_height(dom_element){number}
dom.js, line 1329 -
Gets the global height of an element.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description number Height in px. -
staticH_dom.get_global_position(dom_element){object}
dom.js, line 884 -
Gets the global position of an element.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description object Position {x, y}. -
staticH_dom.get_global_rect(dom_element, force_refresh, debug){object|null}
dom.js, line 779 -
Gets the absolute rect of an element in page coordinates.
Name Type Default Description dom_elementHTMLElement The element. force_refreshboolean optional Force recompute. debugboolean false optional Debug output. Returns:
Type Description object | null Rect object or null. -
staticH_dom.get_global_to_local(dom_element, x, y, advanced){object}
dom.js, line 848 -
Converts page coordinates to local coordinates inside an element.
Name Type Description dom_elementHTMLElement The element. xnumber X coordinate. ynumber Y coordinate. advancedboolean optional Return ratios. Returns:
Type Description object Local coordinates. -
staticH_dom.get_global_width(dom_element){number}
dom.js, line 1316 -
Gets the global width of an element.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description number Width in px. -
staticH_dom.get_position(dom_element){object}
dom.js, line 866 -
Gets the position of an element (offsetLeft/offsetTop).
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description object Position {x, y}. -
staticH_dom.get_relative_position(dom_element){object}
dom.js, line 875 -
Gets the relative position of an element.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description object Position {x, y}. -
staticH_dom.get_style(dom_element){object}
dom.js, line 1419 -
Returns the computed styles for an element.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description object Computed style object. -
staticH_dom.get_style_value(dom_element, attribute_name){string|undefined}
dom.js, line 1405 -
Gets a style value for an element.
Name Type Description dom_elementHTMLElement The element. attribute_namestring CSS attribute. Returns:
Type Description string | undefined Value. -
staticH_dom.has_class(dom_element, class_name){boolean}
dom.js, line 608 -
Checks if a DOM element has a specific class.
Name Type Description dom_elementHTMLElement The element. class_namestring Class name. Returns:
Type Description boolean True if has class. -
staticH_dom.hide_element(element)
dom.js, line 298 -
Hides a DOM element, storing its original display value.
Name Type Description elementHTMLElement The element to hide. -
staticH_dom.insert_after(dom_element, after_me)
dom.js, line 734 -
Inserts a DOM element after another.
Name Type Description dom_elementHTMLElement | string Element to insert. after_meHTMLElement Reference element. -
staticH_dom.insert_before(dom_element, before_me)
dom.js, line 691 -
Inserts a DOM element before another.
Name Type Description dom_elementHTMLElement | string Element to insert. before_meHTMLElement Reference element. -
staticH_dom.insert_script_tag(script_tag)
dom.js, line 136 -
Inserts a script tag into the DOM and executes it.
Handles both external and inline scripts.Name Type Description script_tagHTMLElement The script tag element. -
staticH_dom.is_same_element(a, b){boolean}
dom.js, line 350 -
Checks if two elements are the same.
Name Type Description a* First element. b* Second element. Returns:
Type Description boolean True if same. -
staticH_dom.load_css(url){boolean}
dom.js, line 1577 -
Loads a CSS file into the document head if not already present.
of course the url must respect the CORS rules..Name Type Description urlstring CSS file URL. Returns:
Type Description boolean True if loaded, false if already present. -
staticH_dom.load_script(url){boolean}
dom.js, line 227 -
Loads a script into the document head if not already present.
Name Type Description urlstring Script URL. Returns:
Type Description boolean True if loaded, false if already present. -
staticH_dom.move_to_front(dom_element)
dom.js, line 1795 -
Moves a DOM element to the front by setting a high z-index.
Name Type Description dom_elementHTMLElement The element. -
staticH_dom.move_to_header(id)
dom.js, line 181 -
Moves a script or link element to the document head.
Name Type Description idstring The element ID. -
staticH_dom.point_inside_element(x, y, dom_element){boolean}
dom.js, line 896 -
Checks if a point is inside an element's global rect.
Name Type Description xnumber X coordinate. ynumber Y coordinate. dom_elementHTMLElement The element. Returns:
Type Description boolean True if inside. -
staticH_dom.point_inside_element_data(x, y, dom_element){object}
dom.js, line 908 -
Returns data about a point relative to an element.
Name Type Description xnumber X coordinate. ynumber Y coordinate. dom_elementHTMLElement The element. Returns:
Type Description object Data {inside, rect, localX, localY}. -
staticH_dom.px_to_em(px_value, parent_node, add_em_suffix){number|string}
dom.js, line 1848 -
Converts a pixel value to em units.
Name Type Description px_valuenumber Pixel value. parent_nodeHTMLElement Parent node. add_em_suffixboolean Add 'rem' suffix. Returns:
Type Description number | string Value in em/rem. -
staticH_dom.reload_page(url)
dom.js, line 161 -
Reloads the page or navigates to a given URL.
Name Type Description urlstring optional Optional URL to navigate to. -
staticH_dom.remove_class(dom_element, class_name)
dom.js, line 631 -
Removes a class from a DOM element.
Name Type Description dom_elementHTMLElement The element. class_namestring Class name. -
staticH_dom.remove_css_rule(sheet_id, ruleName, sheet_media){boolean}
dom.js, line 1665 -
Removes a CSS rule from a stylesheet.
Name Type Description sheet_idint Stylesheet ID. ruleNamestring Selector name. sheet_mediaobject Media condition. Returns:
Type Description boolean True if removed. -
staticH_dom.remove_element(element)
dom.js, line 540 -
Removes a DOM element from the document and cleans up events etc.
Name Type Description elementHTMLElement Element to remove. -
staticH_dom.replace_class(dom_element, class_name_to_replace, new_class_name)
dom.js, line 643 -
Replaces a class on a DOM element.
Name Type Description dom_elementHTMLElement The element. class_name_to_replacestring Class to replace. new_class_namestring New class name. -
staticH_dom.replace_element(original_element, new_element)
dom.js, line 666 -
Replaces a DOM element with another, executing scripts if present.
Name Type Description original_elementHTMLElement | string Element to replace. new_elementHTMLElement | string Replacement. -
staticH_dom.restore_mouse_events(dom_element)
dom.js, line 1781 -
Restores the original mouse events on a DOM element.
Name Type Description dom_elementHTMLElement The element. -
staticH_dom.restore_zindex(dom_element)
dom.js, line 1809 -
Restores the original z-index of a DOM element.
Name Type Description dom_elementHTMLElement The element. -
staticH_dom.set_alignment(dom_element, horizontal, vertical, parent_node, from_window)
dom.js, line 1374 -
Sets the alignment of an element within its parent or window.
horizontal and vertical are factor from 0 (left) to 1(right)Name Type Default Description dom_elementHTMLElement The element. horizontalnumber Horizontal alignment (0..1). verticalnumber Vertical alignment (0..1). parent_nodeHTMLElement Parent node. from_windowboolean false optional Use window as reference. -
staticH_dom.set_axis(dom_element, axis, value){boolean}
dom.js, line 1251 -
Sets one local dimension of an element, in px.
The geometry cache of the element and of its descendants is invalidated, so that any following get_global_rect() reads the new value.Name Type Description dom_elementHTMLElement The element. axisstring 'left', 'top', 'width' or 'height'. valuenumber Value in px. Returns:
Type Description boolean False when the axis is not a position or a size. -
staticH_dom.set_global_axis(dom_element, axis, value)
dom.js, line 994 -
Sets one edge of an element in page coordinates.
Moving the left or the top edge resizes the element, so that the opposite edge stays where it is. The coordinate is corrected for the offset and the border of the parent, for the margin of the element, for the scroll of the window when the element is fixed, and for the box model when it is relative.Name Type Description dom_elementHTMLElement The element. axisstring 'left', 'top', 'right' or 'bottom'. valuenumber New coordinate in px, in page coordinates. -
staticH_dom.set_global_bottom(dom_element, new_bottom)
dom.js, line 1093 -
Sets the global bottom position of an element (see set_global_axis()).
Name Type Description dom_elementHTMLElement The element. new_bottomnumber New bottom position. -
staticH_dom.set_global_cursor(cursor_value){boolean}
dom.js, line 1734 -
Sets the global cursor style for the page.
Name Type Description cursor_valuestring CSS cursor value. Returns:
Type Description boolean False if already set. -
staticH_dom.set_global_height(dom_element, new_height)
dom.js, line 1202 -
Sets the global height of an element, accounting for border and padding.
Name Type Description dom_elementHTMLElement The element. new_heightnumber New height in px. -
staticH_dom.set_global_left(dom_element, new_left)
dom.js, line 1066 -
Sets the global left position of an element (see set_global_axis()).
Name Type Description dom_elementHTMLElement The element. new_leftnumber New left position. -
staticH_dom.set_global_min_width(dom_element, new_width)
dom.js, line 1160 -
Sets the global min-width of an element.
Name Type Description dom_elementHTMLElement The element. new_widthnumber New min-width in px. -
staticH_dom.set_global_position(dom_element, x, y)
dom.js, line 940 -
Sets the global position of an element in page coordinates.
Name Type Description dom_elementHTMLElement The element. xnumber X coordinate. ynumber Y coordinate. -
staticH_dom.set_global_rect(dom_element, left, top, right, bottom)
dom.js, line 1223 -
Sets the global rect (left, top, right, bottom) of an element.
Name Type Description dom_elementHTMLElement | object The element or rect object. leftnumber Left position. topnumber Top position. rightnumber Right position. bottomnumber Bottom position. -
staticH_dom.set_global_right(dom_element, new_right)
dom.js, line 1084 -
Sets the global right position of an element (see set_global_axis()).
Name Type Description dom_elementHTMLElement The element. new_rightnumber New right position. -
staticH_dom.set_global_size(dom_element, horizontal, new_size)
dom.js, line 1053 -
Sets the global width or height of an element, accounting for its border and padding.
Width and height are not symmetric: the width of a relative box keeps the unit it was given with (% / rem / em), the height is always written in px.Name Type Description dom_elementHTMLElement The element. horizontalboolean True for the width, false for the height. new_sizenumber New size in px. -
staticH_dom.set_global_top(dom_element, new_top)
dom.js, line 1075 -
Sets the global top position of an element (see set_global_axis()).
Name Type Description dom_elementHTMLElement The element. new_topnumber New top position. -
staticH_dom.set_global_width(dom_element, new_width)
dom.js, line 1102 -
Sets the global width of an element, accounting for border and padding.
Name Type Description dom_elementHTMLElement The element. new_widthnumber New width in px. -
staticH_dom.set_height(dom_element, h)
dom.js, line 1275 -
Sets the height of an element in local coordinates.
Name Type Description dom_elementHTMLElement The element. hnumber Height in px. -
staticH_dom.set_left(dom_element, x)
dom.js, line 1284 -
Sets the left position of an element in local coordinates.
Name Type Description dom_elementHTMLElement The element. xnumber Left position in px. -
staticH_dom.set_position(dom_element, x, y, css_position)
dom.js, line 1345 -
Sets the position of an element in local coordinates.
use H_dom.RELATIVE or H_dom.ABSOLUTE for specify the css_position parametersName Type Description dom_elementHTMLElement The element. xnumber | object X position or {x, y}. ynumber Y position. css_positionstring optional CSS position value. -
staticH_dom.set_rect_dirty()
dom.js, line 1538 -
Marks only the rect of an element and its children as dirty and to recompute.
-
staticH_dom.set_size(dom_element, w, h)
dom.js, line 1303 -
Sets the width and height of an element in local coordinates.
Name Type Description dom_elementHTMLElement The element. wnumber Width in px. hnumber Height in px. -
staticH_dom.set_style_dirty(dom_element)
dom.js, line 1531 -
Marks the style of an element as dirty for recomputation.
Name Type Description dom_elementHTMLElement The element. -
staticH_dom.set_style_value(dom_element, attribute_name, value){boolean}
dom.js, line 1552 -
Sets a style value for an element and marks as dirty if changed.
Name Type Description dom_elementHTMLElement The element. attribute_namestring CSS attribute. valuestring Value to set. Returns:
Type Description boolean True if changed. -
staticH_dom.set_top(dom_element, y)
dom.js, line 1293 -
Sets the top position of an element in local coordinates.
Name Type Description dom_elementHTMLElement The element. ynumber Top position in px. -
staticH_dom.set_width(dom_element, w)
dom.js, line 1266 -
Sets the width of an element in local coordinates.
Name Type Description dom_elementHTMLElement The element. wnumber Width in px. -
staticH_dom.show_element(element, force_visibility_value)
dom.js, line 318 -
Shows a previously hidden DOM element.
and restore its visibility to the original one or to an opationnal force_visibility_valueName Type Description elementHTMLElement The element to show. force_visibility_valuestring optional Optional display value. -
staticH_dom.string_to_dom(str, multiple, active_script){Node|NodeList}
dom.js, line 259 -
Converts an HTML string to DOM nodes.
Optionally activates scripts and returns multiple nodes.Name Type Default Description strstring HTML string. multipleboolean false optional Return all nodes. active_scriptboolean false optional Activate scripts. Returns:
Type Description Node | NodeList The DOM node(s). -
staticH_dom.toggle_class(dom_element, class_name, force_state)
dom.js, line 655 -
Toggles a class on a DOM element.
Name Type Description dom_elementHTMLElement The element. class_namestring Class name. force_stateboolean optional Force toggle state. -
staticH_dom.unset_global_cursor()
dom.js, line 1746 -
Unsets the global cursor style.
-
staticH_dom.write_html(target, html_data, append, before)
dom.js, line 63 -
Insert HTML code inside a dom element
Ensures scripts are executed. Replace content by default.Name Type Default Description target* Element to insert inside. html_datastring | HTMLElement HTML to insert. appendboolean false optional True to append new content. beforeboolean false optional True to prepend the content.