While developing your nice JavaScript application you have to test if it works as well with all those different browsers your future users could use. Today I stumbled across a problem with Opera.

Imagine the following code:

var form = $(document.createElement("form"));
var e = $(document.createElement("textfield"));
Event.observe(e, "keypress", function(a){Event.stop(a);});

You would imagine, that this code would stop the event from beeing propageted if a keypress event is received. Usually this works fine in almost all browsers, well there is the problem: almost all. In Opera this works like it is expected to work but with one difference: if you press the enter key, two events will be fired – one is the keypress event for the textfield and the other event for the surrounding form. In this case the Even.stop() method will not work. The only way to prevent the form from beeing submitted is to stop the event directly within the form.

Now you will ask where do we need such input fields? Imagine the InPlaceTextfield and the Autocomplete from script.aculo.us as examples. By now there is no correct support for opera, if you use these controls.