behavior:dropdown-select

Standard behavior of <select> with dropdown option lists.

Elements

These elements have behavior:select applied by default:

Model

The behavior transforms select declaration:

<select>
  <option value="#ff0000" selected>Red</option>
  <option value="#00ff00">Green</option>
  <option value="#0000ff">Blue</option>
</select>

into this

<select>
  <caption>Red</caption>
  <button />
  <popup>
    <option value="#ff0000" selected>Red</option>
    <option value="#00ff00">Green</option>
    <option value="#0000ff">Blue</option>
  </popup>
</select>

These parts get default styling from master.css but can be re-styled by host document styles if needed.

Attributes

This behavior knows about:

Events

Other than standard set of events (mouse, keyboard, focus) behavior:dropdown-select generates:

State flags

Other than standard state flags like :hover, :active, :focus and so on the dropdown also manages:

Commands

Note: commands are invoked by calling element.execCommand("cmd-name"[,params])

Methods

showPopup([true|false])
- shows (or closes) popup list widget.

Properties

Other than standard properties of DOM elements the dropdown also supports:

Value

Selection change handling in script

raw onValueChanged handler

var btn = $(select#some);
btn.onValueChanged = function() { var v = this.value; ... }

on() subscription

var btn = $(select#some);
btn.on("change", function() { ... event handling code ... });
self.on("change", "select#some", function() { ... event handling code ... });

decorators.tis handler

include "decorators.tis";
@change @on "select#some" :: ... event handling code ...;