Skip to main content

Behaviors - native extensions of standard DOM elements

Behaviors in Sciter are native "DOM element controllers" that get attached to DOM elements by CSS:

div.editable {
behavior:edit; // this div behaves as a text editing field
white-space:pre;
overflow-x:hidden-scroll;
border:1px solid;
}

Each behavior may have its own methods and properties accessible by JavaScript.

In order to avoid name collisions with standard DOM elements those methods and properties are accessible by dot notation that contains behavior name as an "interface name":

let el = document.$("div.editable");

el.edit.setRange(0,10); // call method of behavior:edit

Here is a list of such built-in behaviors that are available out of the box in Sciter: