>> It's actually a really small addition, just something like:
>> if ( elem[ fnName ] )
>> elem[ fnName ]();
>
> Yes, but which do you run first, the native fn or the
> 'on' fn? Or do you run them both? I think it's not quite
> as simple as this.
I thought that .submit() was going to disappear in 1.1, in preference to the
more explicit .on("submit") and .trigger("submit"). That leaves the
verb-method .submit() unused and free to be whatever it wants to be.
But is it really that useful to define $().submit() at all? Most of the time
you're submitting a single form, which means a new proposed
$("#myform").submit() === $("#myform")[0].submit(). The latter makes it very
clear you are calling the submit method of the form element, because--well,
because you _are_ calling the submit method of the selected form element!
:-) No additional jQuery code or documentation required.
I think the current confusion comes from people seeing (or blindly using)
$().submit() and somewhat reasonably expecting it to map to form.submit().
That confusion will disappear if there is no submit method on a jQuery
object at all. Conversely, if $().submit() is going to be a "shortcut" for
$()[0].submit(), then why not other useful DOM methods like input.focus()
and input.blur() as well? Then we're back to creating jQuery macros and
documentation for things that are already pretty easy to type and documented
in the standard DOM interface.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/