nanatiris / jquery-watermark

Automatically exported from code.google.com/p/jquery-watermark
0 stars 0 forks source link

IE 6, 7, 8 broken form submission under odd circumstances #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I've spent the best part of today wrangling with an odd issue in IE. I narrowed 
it down ultimately 
to the watermark plugin (sorry). But getting there is somewhat convoluted.

So the watermark plugin works in IE 6, 7 and 8. No problem yet. Now, I have a 
Google Map and a 
form on the page also. When I type into my watermark field this creates a poly 
line on the Google 
Map. The act of doing this means that when I click the submit button for the 
form a jQuery error 
is thrown.

I tried both 1.4.2 ..
Line 3136 return "text" === elem.type;

And 1.3.2
Line 19 return"text"===T.type

Now, you need to trust me on this. If I comment out watermark binding it all 
works in IE. If I don't 
then boom. 

I can even make this work by commenting out the line of code that adds the poly 
line addOverlap 
for Google Maps. 

There is some real nasty causation going on somewhere but the only solution is 
to comment out 
watermark for IE clients. 

That's the best I can provide I'm afraid. 

What version of the product are you using? On what operating system?

IE 6, 7, 8

Please provide any additional information below.

Original issue reported on code.google.com by allist...@gmail.com on 2 Jun 2010 at 3:46

GoogleCodeExporter commented 9 years ago
I'm also getting this error. I'm not sure exactly what is causing it but when I 
have the watermark added to my form it causes an error in jQuery when the forum 
is submitted, either via calling the submit event or just through a manual form 
submission using a submit button.

It must be something else on the page that is causing the problem with the 
watermark plugin.

Original comment by disc...@gmail.com on 21 Jun 2010 at 3:54

GoogleCodeExporter commented 9 years ago
Please install the latest release - 3.0.6.  I can't guarantee the plugin will 
work with every combination of third party software, but I have inserted many 
sanity checks in the latest version that should catch errors like what you've 
been seeing.

I'll close this issue, but please post again if you find this or something else 
that interacts unexpectedly.

Original comment by t...@speednet.biz on 22 Jun 2010 at 2:38

GoogleCodeExporter commented 9 years ago
I experience this issue also.

Am not using google maps, and only a few jQuery UI widgets.
Tried jQuery 1.4.2 and 1.4.4
Using watermark 3.0.6.

stack:
jquery.watermark.js   hideAll: 
$.watermark.hide(":text,:password,:search,textarea")
jquery.watermark.js   hide: $(selector).filter(selWatermarkDefined).each(
jquery-1.4.4.js(25)   return new jQuery.fn.init( selector, context );
               (188)  return new jQuery.fn.init( selector, context );
               (4340) jQuery.find( selector, this[i], ret );
               (4119) return oldSizzle(query, context, extra, seed);
               (3098) set = ret.expr ? Sizzle.filter(ret.expr, ret.set) : ret.set;
               (3269) found = filter( item, match, i, curLoop );
               (3677) return filter( elem, i, match, array );
               (3601) return "text" === elem.type;

typeOf elem is DispHTMLGenericElement
elem.type is not defined
console.log(elem.type) returns "failed"

I initialize with:

function showWatermarks(isInit) {
    $('#searchCriteria [placeholder]').each(function () {
        var that = $(this);
        if (isInit) that.watermark(that.attr('placeholder'));
        else that.watermark();
    });
}

With no elements matching the selector, form submission works fine. With 
matching elements, I get the error described by the first reporter, a very 
vague "Error" statement from IE.

Original comment by syndicat...@gmail.com on 30 Nov 2010 at 1:31

GoogleCodeExporter commented 9 years ago
Correction, a very vague "Failed" message, the same as returned by 
console.log(elem.type) when broken on the error.

The error is the same as referred to in this article:
http://samuli.hakoniemi.net/when-jquery-returns-failed-in-ie-and-how-its-probabl
y-resolved/

It doesn't surface any errors in the browser status, only in the script 
debugger. After this of course my form submit is not canceled, so the page 
navigates away. Perhaps browser status would otherwise reflect javascript 
errors.

Also, the invalid element iteration is first selected by stack line 3269

    if ( match ) {
        for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
            if ( item ) {
                found = filter( item, match, i, curLoop );

see attached graphic for details.

Original comment by syndicat...@gmail.com on 30 Nov 2010 at 7:23

Attachments:

GoogleCodeExporter commented 9 years ago
also of note, I've tested again with jquery.ajaxmanager as the only plugin 
referenced.
That plugin is core to my app, so I didn't rip it out, but it doesn't do 
anything active with the DOM anyway, afaik, and the error occurs the first and 
every form submission.

Original comment by syndicat...@gmail.com on 30 Nov 2010 at 4:03

GoogleCodeExporter commented 9 years ago
I'm guessing that the problem is that you are trying to use the placeholder 
attribute.  Don't do that, because the plugin manipulates the placeholder 
attribute directly.

You can try using an attribute such as data-placeholder, which in jQUery 1.4.4 
gives the added benefit of allowing you to retrieve the text like 
$("#id").data("placeholder").

Original comment by t...@speednet.biz on 3 Dec 2010 at 4:04

GoogleCodeExporter commented 9 years ago
That's correct, I was trying to use the "placeholder" attribute.  I'll stop 
that :)  Thank you for the followup.

Original comment by syndicat...@gmail.com on 3 Dec 2010 at 6:12