Skip to content

Commit 34fbed7

Browse files
committed
jquery-form#386; account for elements that use form attribute
1 parent d235e9a commit 34fbed7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

jquery.form.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,21 @@ $.fn.formToArray = function(semantic, elements) {
912912
}
913913

914914
var form = this[0];
915+
var formId = this.attr('id');
915916
var els = semantic ? form.getElementsByTagName('*') : form.elements;
916-
if (!els) {
917+
var els2;
918+
919+
if ( els )
920+
els = $(els).get(); // convert to standard array
921+
922+
// #386; account for inputs outside the form which use the 'form' attribute
923+
if ( formId ) {
924+
els2 = $(':input[form=' + formId + ']').get();
925+
if ( els2.length )
926+
els = (els || []).concat(els2);
927+
}
928+
929+
if (!els || !els.length) {
917930
return a;
918931
}
919932

0 commit comments

Comments
 (0)