Watching user input
A problem often encountered when making interfaces with JavaScript is how to get a function to run whenever a user changes the value of a text field. onchange only happens when the focus leaves the control, onkeyup will pick up useless strokes (like arrow keys) and won’t pick up on changes done by the mouse (like clipboard commands and dragging).
One very compelling option appears to be the watch method of JavaScript objects. Watch lets you define a function to run whenever an object’s property changes. Sounds perfect? Unfortunately, the watch argument only gets fired by changes to the property from JavaScript. Changes to the property from native code (like when the user changes the input) don’t fire the function.
Luckily for extension authors, XUL defines an additional type of event called “input“. This changes whenever the user changes the text in the control. Unfortunately, it can’t be used in web pages.