#9553 closed bug (patchwelcome)
"Invalid calling object" in IE9 with DivX
Reported by: | mortenkrane | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | misc | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This is a bug that only appears in Internet Explorer 9 with DivX extensions installed and enabled. So its up for debate whether this is actually a jQuery bug or not, since its quite clearly a consequence of something the DivX extension does, but I found that everything stopped working for IE9 users until I made a rather nasty and specific workaround (see my comment here: http://forum.jquery.com/topic/internet-explorer-9-jquery-and-divx#14737000002443139).
(Also, I am surprised that the above forum post is the only other reference to this situation I can find, but that may of course be due to my searching skills.)
The bug seems to appear after the DivX plugin downloads some resource (and presumably does something in the DOM). After this happens I cannot append anything to the body element. In the Developer Toolbar console I get the error message "Invalid calling object".
I could not reproduce this in jsFiddle, but loading the code below into IE9 with DivX yields the error message every time for me.
<!DOCTYPE html> <html> <head><title>jQuery test</title></head> <body> <h1>Testing jQuery bug</h1> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var b = $("body"); var s1 = "<span>Now it works</span>"; var s2 = "<span>Now it doesn't</span>" b.append(s1); // Giving the DivX extension time to set up setTimeout(function() { b.append(s2); }, 2000); }); </script> </body> </html>
Also, using the console to append elements to the body yields the same error message.
I can append to any other element in the page, its only the body that fails. When disabling the DivX extension and restarting IE, everything works as expected. Setting the browser in IE8 document mode also seems to solve the problem.
I have reproduced this with jQuery 1.6.1, 1.5.1 and 1.5.2.
Again, I apologize if this is outside of jQuery's realm.
Morten
Change History (11)
comment:1 Changed 12 years ago by
Component: | unfiled → misc |
---|---|
Priority: | undecided → low |
Resolution: | → patchwelcome |
Status: | new → closed |
comment:3 Changed 12 years ago by
a lot of users have that plugin. we're having to spend lots of time doing work arounds to fix this.
comment:4 Changed 12 years ago by
The plug that breaks it is a beta... Name: DivX Plus Web Player HTML5 <video> Publisher: DivX, LLC Type: Browser Helper Object Version: 2.1.0.900 File date: Date last accessed: 17 June 2011, 22:54 Class ID: {326E768D-4182-46FD-9C16-1449A49795F4} Use count: 55 Block count: 7 File: npdivx32.dll Folder: C:\Program Files (x86)\DivX\DivX Plus Web Player
and
Name: DivX HiQ Publisher: DivX, LLC Type: Browser Helper Object Version: 2.1.0.900 File date: Date last accessed: 17 June 2011, 22:54 Class ID: {593DDEC6-7468-4CDD-90E1-42DADAA222E9} Use count: 57 Block count: 5 File: npdivx32.dll Folder: C:\Program Files (x86)\DivX\DivX Plus Web Player
New versions don't break jQuery.
comment:5 Changed 12 years ago by
Solution:
For all appendChild, replaceChild and insertBefore must be used: this.appendChild = document.appendChild;
Example:
<body> <script type="text/javascript"> $(document).ready(function() {
jQuery.fn.append = function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild = document.appendChild; this.appendChild( elem );
}
});
}
} </script>
comment:6 Changed 12 years ago by
The solution provided above by Anonymous does not fix the issue... tested on IE9 with "DivX Plus Web Player HTML5 <video>" Version 2.1.0.900.
Not for me anyways.
comment:7 Changed 11 years ago by
Here's an interesting read about a similar issue on DivX forums: http://labs.divx.com/node/16824
You gotta love their way of doing things.
comment:8 Changed 11 years ago by
It seems this problem is fixed with the current DivX Web Player update: My version: Name: DivX Plus Web Player HTML5 <video> Version: 2.1.2.126
You can use the following code to check if he has installed the broken Plugin and tell him to update the plugin:
$(document).ready(function(){ /* after the page has finished loading */ // Detect if there is a broken DivX plugin // Giving the DivX extension time to set up setTimeout(function() { try { $("body").append("<div></div>"); } catch (e) { alert("(EN) There is an error in your DivX Web Player Addon. Please update it with the following url:\n(DE) Es existiert ein Problem mit Ihrem DivX Web Player Addon. Wir bitten Sie, dieses unter folgendem Link zu aktualisieren:\n(IT) Esiste un problem con l'addon DivX Web Player. Si prega di aggiornare con il seguente link:\n\nhttp://www.divx.com"); } }, 2000); }
comment:9 Changed 11 years ago by
Thank you Probot! I was searching far and wide for this answer and your solution worked perfectly. Much appreciated.
comment:10 Changed 11 years ago by
This solve for me... I was trying this whithout success:
item = $('<div>testing...</div>') $("#some_id").append(item);
and the correct is:
var item = $('<div>testing...</div>') $("#some_id").append(item);
comment:11 Changed 10 years ago by
I incurred this error when I misnamed one of the parameters to a getJSON call.
amountaid: xvalue instead of amountpaid:
It was hard to track down until I used Firefox to load the page and Firefox's web console debugger, which gave up the error: [12:39:17.881] NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument @ http://extensions/hunterbadminton/assets/js/jquery-1.8.3.js:7218
In both cases the error message is arcane, but Firefox actually led me to what was wrong and I spotted the error immediately.
Thanks for submitting a ticket to the jQuery Project. Unfortunately, because we would consider this type of ticket an edge-case which is likely down to the DivX extension and it's behaviour with IE as opposed to jQuery core (and this is the first I've ever read about it) we're likely not going to be able to dedicate time and resources to getting this patched. We would however be willing to consider adopting a patch if you or another member of the community were interested in discovering an acceptable workaround. Please bare in mind this would of course be dependant on the bug actually being something a number of people are experiencing as opposed to a small minority.