Skip to main content

Bug Tracker

Side navigation

#9303 closed bug (invalid)

Opened May 16, 2011 10:25PM UTC

Closed May 16, 2011 10:57PM UTC

Last modified March 09, 2012 03:45AM UTC

.submit broken on form element

Reported by: Jonathan Horowitz <jhorowitz@cs.uri.edu> Owned by:
Priority: low Milestone: 1.next
Component: event Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

This bug affects all versions of jQuery since 1.4.1, but is readily apparent as of 1.6 due to the removal of the try...catch block originally intended to fix bug #3533, which was also catching the error thrown by this bug.

It seems to have been introduced by the fix for bug #5695.

I have reproduced this bug on Firefox 4.0.1 (on Gentoo Linux 32bit) and IE 8.0.6001.18702 (on Windows XP Pro, 32bit).

To reproduce, simply use the .submit() function as per the API.

E.g.:

$("form").submit();

What should happen is that the form submits.

What actually happens is that the following error is thrown (In Firefox Firebug console view):

fileName: "javascript:alert('TODO: FIXME')"
lineNumber: 0
message: "stopPropagation is not defined"
name: "ReferenceError"
stack: "onsubmit()@javascript:alert('TODO: FIXME'):0 @:1 ([object Object],[object Array],[object HTMLFormElement])@http://localhost:8080/path/jquery.js:1785 (0,[object HTMLFormElement])@http://localhost:8080/path/jquery.js:2315 ([object Object],(function () {jQuery.event.trigger(type, data, this);}),(void 0))@http://localhost:8080/path/jquery.js:547 ((function () {jQuery.event.trigger(type, data, this);}))@http://localhost:8080/path/jquery.js:240 ("submit")@http://localhost:8080/path/jquery.js:2314 ()@http://localhost:8080/path/jquery.js:2438 caSubmitForm([object Object],"_self")@http://localhost:8080/path/ca2.js:1035 caSubmit([object HTMLAnchorElement],[object Proxy],"4524","","","","_self","false",false,(void 0))@http://localhost:8080/path/ca2.js:1122 onclick([object MouseEvent])@http://localhost:8080/path/servlet:1 "
__proto__: ReferenceError { name="ReferenceError", lineNumber=0}

In IE, an "Object expected" error is thrown.

From my tests, it appears that the call to

form["onsubmit"].apply(...)

is to blame. This calls the onsubmit handler, which contains

stopPropagation();

In v1.4, it would instead call

form["submit"]()

which works fine.

Attachments (0)
Change History (2)

Changed May 16, 2011 10:35PM UTC by Jonathan Horowitz <jhorowitz@cs.uri.edu> comment:1

nevermind... I missed a call in simplifying my example code; the fault lies with me, not jQuery. Please close this.

Changed May 16, 2011 10:57PM UTC by rwaldron comment:2

component: unfiledevent
priority: undecidedlow
resolution: → invalid
status: newclosed