Submit don't bubble but could be simulated. I have been working on
simulating the bubbling for submit/reset/change/focus/blur, but I
don't have any free time those days:
(function(){
function isEventSupported(eventName){
var element = document.createElement("div"), result;
eventName = "on" + eventName;
if (eventName in element){
return true;
}
element.setAttribute(eventName, "return;");
result = Object.isFunction(element[eventName]);
element = null;
return result;
}
if (!isEventSupported('submit')){
function isForm(element) {
return Object.isElement(element) &&
element.nodeName.toUpperCase() == 'FORM';
}
function skipOneSubmit(e){
Event.preventDefault(e);
Event.stopObserving(this, 'submit', skipOneSubmit);
}
function emulateSubmit(e, element){
if (element.form && element.fire('emulated:submit').stopped){
Event.observe(element.form, 'submit', skipOneSubmit);
}
}
document.on('mousedown', 'input[type=submit],input[type=image]',
emulateSubmit);
document.on('keydown',
'input[type=file],input[type=text],input[type=password],input[type=submit]',
function(e, element){
if (e.keyCode == Event.KEY_RETURN){
emulateSubmit(e, element);
}
});
Event.Handler.prototype.initialize =
Event.Handler.prototype.initialize.wrap(function(initialize, element,
eventName, selector, callback) {
if (eventName == 'submit' && !isForm(element)){
eventName = 'emulated:' + eventName;
}
initialize(element, eventName, selector, callback);
};
}
})();
This is just cut - paste from a bigger script, so it could contain
errors. I still haven't tested.
Hope this will could be some help, if try using it please send me some
feedback :)
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.