From ffa0d0943c07b9519a2f7ab2a7512ca652423d92 Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Fri, 25 Jan 2008 18:54:22 +0000 Subject: [PATCH] Roll back the fix for #9609, since it does not work in Opera. Instead, avoid using "valueOf" or "toString" as field names in forms. --- CHANGELOG | 2 ++ src/form.js | 2 +- test/unit/form.html | 8 -------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0476ff7..1a98cf8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Roll back the fix for #9609, since it does not work in Opera. Instead, avoid using "valueOf" or "toString" as field names in forms. + * Prevent DOM node expandos _countedByPrototype and _prototypeEventID from being serialized into (inner|outer)HTML in IE. Closes #10909. [dcpedit, Tobie Langel, Andrew Dupont] * Make Ajax.Request#isSameOrigin JavaScript Lint compliant. [Andrew Dupont] diff --git a/src/form.js b/src/form.js index 78c03ff..0fd2ef3 100644 --- a/src/form.js +++ b/src/form.js @@ -14,7 +14,7 @@ var Form = { key = element.name; value = $(element).getValue(); if (value != null && (element.type != 'submit' || (!submitted && submit !== false && (!submit || key == submit) && (submitted = true)))) { - if (key in result && !Object.isFunction(result[key])) { + if (key in result) { // a key is already present; construct an array of values if (!Object.isArray(result[key])) result[key] = [result[key]]; result[key].push(value); diff --git a/test/unit/form.html b/test/unit/form.html index 14a3fbb..3e8aaec 100644 --- a/test/unit/form.html +++ b/test/unit/form.html @@ -125,11 +125,6 @@ -
- - - -
@@ -407,9 +402,6 @@ assertHashEqual({ val1:4, action:'blah' }, $('form').serialize({ submit: 'inexistent' })); - // try to serialize form containing toString, valueOf and length -named elements - assertHashEqual({ length: 'foo', toString: 55, valueOf: 'bar' }, - $('trouble_form').serialize(true)); }}, testFormMethodsOnExtendedElements: function() {with(this) {