开发者

jQuery form plugin works in Firefox & IE, but adds an invalid ID to webkit forms?

I have a very strange issue that only affects webkit browsers for some reason, I have written a little jQuery form plugin that takes care of validation and applies state classes for easy css styling but it does not touch the form id attribute.

However in Safari 5 and Google Chrom开发者_如何学Goe for Mac the form is being assigned id="[object HTMLInputElement]" which breaks the form…

I have tried isolating the issue by commenting out lines of the jQuery plugin but this didn't get me anywhere.

I also seem to have found that by removing the following line from a bunch of CMS (ExpressionEngine) generated hidden fields fixes this issue:

<input type="hidden" name="id" value="freeform" />

but for obvious reasons I cannot remove that line from the code (generated by cms) also if I leave the line in the source and disable my script it also does not break so it seems to be a specific issue with that line of html, my plugin and webkit.

Any help would be much appreciated, I have already spend close to a day trying this thing out but can't seem to fix it.

Here is a jsFiddle I have setup that shows this problem: http://jsfiddle.net/jannis/5CMdP/

It works fine in non-webkit but in webkit when looking at the form in the bottom right output frame you'll notice the form having the invalid id attribute.

Thanks for checking this out.

Much appreciated.

Jannis


Definitely a 1.4.3 bug, see here:

http://bugs.jquery.com/ticket/7212

(Bug) find() to fail when selecting from forms containing inputs named “id”

Sound familiar? :)

See here for a patch if you want to keep using 1.4.3 (its in sizzle):

https://github.com/jeresig/sizzle/commit/b758239


It looks like it's a bug in the version of jQuery the fiddle is using. Switching to 1.4.4 fixes the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜