IE bug: line 161 "Object doesn't support this property or method"

MichaelCole - January 19, 2007 - 08:12
Project:Fivestar
Version:5.x-1.3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

IE Version 6.0.2900.2180.xpsp_sp2_gdr.050301-1519

Clicking on the stars then this error.

Bummer dude.

Mike

#1

MichaelCole - January 19, 2007 - 08:14

The Microsoft Script Editor debugger points to one monstrous line of code

#2

MichaelCole - January 19, 2007 - 08:16

One last thing... The vote "stays" so if I click 2 stars, I get the error, but the control remembers my vote.

The cancel rating button works ok.

#3

mkjones - January 30, 2007 - 09:58

I was getting this yesterday with IE6, however the vote was still case, is that correct?

#4

mkjones - January 30, 2007 - 09:58

sorry, I mean: "the vote was still cast"

#5

ivix - February 12, 2007 - 08:33

Getting the same error in IE7.

#6

mr700 - February 20, 2007 - 17:43

I can confirm this, I get:

Line 187 Char 3
Invalid argument (when the node is rendered)
Line 162 Char 8
Object doesn't support this property or method (every time I click something)

#7

mr700 - February 20, 2007 - 20:20

In jquery.js 1.0.4 (not the packed version) from node 110935 comment 13 at line 1521(1519 in the unpatched version) in find: function( t, context ) there's:

                                                for ( var i = 0; i < ret.length; i++ )
                                                        r = jQuery.merge( r,
                                                                m[2] == "*" ?
                                                                        jQuery.getAll(ret[i]) :
                                                                        ret[i].getElementsByTagName(m[2])
                                                        );

The error occurs on ret[i].getElementsByTagName(m[2]).

#8

mr700 - March 14, 2007 - 01:22
Status:active» needs review

I think I figured this out (by trial and error but anyway). There are actually two separate errors, but I don't know how to 'clone' this bug here I'll put two patches.

The first problem is that the 'fix ie6 background flicker problem' is for IE=6 only, not 6.x, so

<?php
       
// fix ie6 background flicker problem.
       
if ($.browser.msie == true) {
               
document.execCommand('BackgroundImageCache', false, true);
        }
?>

should probably be
<?php
 
// fix ie6 background flicker problem.
 
if ($.browser.msie == true) {
    try {
     
document.execCommand('BackgroundImageCache', false, true);
    } catch(
err) {}
  }
?>

or http://www.hedgerwow.com/360/bugs/dom-fix-ie6-background-image-flicker.html is a better idea, haven't tried this one.
NB: This is patch 1/2.

AttachmentSize
fivestar-01-fix-ie-fix.patch 695 bytes

#9

mr700 - March 14, 2007 - 01:38

And the second one. I have absolutely no idea what and how this code works (almost), but changing '$(data)' with 'data' in voteHook silences my IE6. I've tested this one (with the previous patch applied too) with FF 1.5, Konqueror 3.5.6, Opera 9.10 and IE 6.0.2800.1106.xpsp1.020828-1920 and all they work without any error. Clicking on the stars shows ..../fivestar/vote/node/[nid]/[rating] in my apache logs and the database changes accordingly, so I assume I got lucky and fixed it. Here are the change and the patch:
old code:

       returnObj.result.count = $("count",$(data)).text();
       returnObj.result.average = $("average",$(data)).text();
       returnObj.vote.id = $("id",$(data)).text();
       returnObj.vote.type = $("type",$(data)).text();
       returnObj.vote.value = $("value",$(data)).text();

new code:
       returnObj.result.count = $("count",data).text();
       returnObj.result.average = $("average",data).text();
       returnObj.vote.id = $("id",data).text();
       returnObj.vote.type = $("type",data).text();
       returnObj.vote.value = $("value",data).text();

Would be nice if someone who understands jQuery can verify this...

AttachmentSize
fivestar-02-fix-voteHook.patch 1.08 KB

#10

mr700 - March 14, 2007 - 01:59

If the previous two patches are ok, here's one that includes them and also removes the extra spaces and makes the code indentation match drupal coding standards (maybe just attaching the new file was a better idea).

AttachmentSize
fivestar-10-fix-ie_voteHook_indent.patch 12.94 KB

#11

jonathan_hunt - March 19, 2007 - 22:43

I applied these patches manually. Fivestar now works ok on IE6 and IE7.

#12

b_f - April 18, 2007 - 01:57

Yes, the two patches correct the problem. Thanks, Doncho.

#13

quicksketch - April 24, 2007 - 05:31
Status:needs review» needs work

Thanks mr700! I applied your IE flicker patch and committed to CVS. Unfortunately the second patch (removing $) breaks Firefox 2 (Mac) in my testing. There are like 6 issues open with this same problem, so one of them will probably work :D

#14

quicksketch - April 25, 2007 - 04:59
Status:needs work» fixed

Okay, both patches were fantastic :)

I combined the second patch with http://drupal.org/node/132666, which properly sets the content type on the returned xml. Now jQuery gets an XMLObject (not html) returned in all browsers. Firefox had been compensating and reading it as XML, but oddly... IE was doing the right thing! First time for that one...

Thanks again mr700. Both are now applied and will be in the 1.5 release.

#15

mr700 - April 28, 2007 - 18:22

Thank you too.

#16

Dries - May 14, 2007 - 20:36
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.