v7.3.0
SupportExamplesFree Trial

DomHelper

A static utility class for DOM element creation, querying, and manipulation. It provides createElement to build element trees from DomConfig objects, and includes helpers for measuring, focusing, scrolling, and synchronizing DOM structures.

DomHelper.createElement({
  tag       : 'div',
  className : 'parent',
  style     : 'background: red',
  children  : [
     { tag: 'div', className: 'child' },
     { tag: 'div', className: 'child' }
  ]
});

Useful functions

Function Description
createElement Create an element from a DomConfig object
sync Sync a DomConfig to an existing DOM tree
isVisible Check whether an element is visible

See also

No results

Properties

Properties are getters/setters or publicly accessible variables on this class
  • activeElement : HTMLElement
    READONLY
    static

    Returns active element checking shadow dom too

  • Check if the currently used theme is a dark theme, by checking the color-scheme property of .b-widget.

  • primaryColor : String
    READONLY
    static

    Get the current themes primary color (by reading it from document.body)

  • scrollBarWidth : Number
    READONLY
    static

    Measures the scrollbar width using a hidden div. Caches result

  • scrollLimit : Number
    READONLY
    static

    Returns the maximum scroll range the browser can correctly manage. This value is browser-specific and typically in the millions of pixels. This answer is not intended to be a precise value but a safe and reliable value to avoid encountering browser limitations.

  • themeInfo : ThemeInfo
    READONLY
    static

    A theme information object about the current theme. Note, when using Bryntum widgets inside a shadowRoot context, you need to use getThemeInfo and pass a context element.

Functions

Functions are methods available for calling on the class
  • Resets DomHelper.scrollBarWidth cache, triggering a new measurement next time it is read

  • Toggles between light and dark themes. Does not check if the theme is actually available, only does a string replace on the current themes filename for light/dark.

    Type definitions

    Source path

    Core/helper/DomHelper.js

    Contents