Ticket #5417 (closed defect: fixed)
Widgets: support more (all?) of the on* handlers
| Reported by: | bill | Owned by: | doughays |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | Dijit | Version: | 0.9 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by bill) (diff)
There are a myriad of events on native HTML form nodes (like <input>), such as
- onkeyup
- onkeydown
- onfocus
- onblur
- onmousedown
It would be nice to support the same set of events on Form widgets, so you could do
<button dojoType=dijit.form.Button onmousedown=...> <input dojoType=dijit.form.ValidationTextBox onkeyup=...>
or
<button dojoType=dijit.form.Button> <script type="dojo/connect" event="onmouseover"> ... </script> hello world </button> <input dojoType=dijit.form.ValidationTextBox> <script type="dojo/method" event="onmouseout"> ... </script> </input>
(I guess dojo/connect and dojo/method would have the same effect in this case.)
... or even:
var b = new dijit.form.Button(); dojo.connect(b, "onmousemove", myFunc);
There are two issues which make this difficult:
unnecessary connects:
The form widgets don't support the ability to connect to all these events since those events are seldom used and I didn't want to do a bunch of unnecessary connects on every widget instance.
With attributeMap, we may be able to work around the unnecessary connects problem, although I think that would only address the first example I listed above, and wouldn't help when developers try to do a dojo.connect()
more complicated than just connect:
Take for example the spinner widget. Implementing onblur and onfocus is more complicated than connecting to the onblur and onfocus of Spinner.focusNode: clicking the spinner up/down buttons will cause the Spinner.focusNode to lose focus (on some browsers), but the *widget* is still conceptually focused, so onblur shouldn't be called. In that case the _onFocus and _onBlur handlers can be used to tell when the widget itself blurs or focuses, but there may be problems with other widgets.
Leaving for consideration for 2.0 (if not sooner).