Skip to content

Framework DOM Functions

Rendering
Web Properties

The framework contains a layer of functions that smoothen out most differences between the browser. These functions can be found in the dom.js (df.dom.*), events.js (df.events.*), and sys.js (df.sys.*). These functions should all have the same result under the different browsers. Below is an overview of the most commonly used functions.

df.dom.query

This method is used within the framework to get references to DOM elements. It is used instead of document.getElementById. Internally, it uses the querySelector or querySelectorAll APIs of the browser. A CSS-like selector can be passed to specify the searched elements.

Parameters

Parameter Type Description
eElem DOM Element Element wrapping the searched elements.
sSelect String CSS Selector string like "div.MyClass" or "#MyId" or "#MyId div.MyClass".
bOptMulti Boolean (optional, default is false) If true, an array with all matching elements is returned instead of the first match.

df.events.addDomListener

This method is used within the framework to attach event handlers to DOM elements. It is part of a browser-independent layer on top of the browsers' event handling system.

Parameters

Parameter Type Description
sEvent String W3C name of the event like "click" or "mouseover".
eElem DOM Element Reference to the DOM element to handle the event of.
fListener Function Reference to the function that will handle the event.
oOptEnv Object (optional) Object that will be the context when the event handler is called. Usually, you pass this here.

Previous Topic: Rendering
Next Topic: Web Properties

See Also

Developing Web Applications