Diego A. wrote:
I've been fighting with this bug too and I believe I've found the fix.
I can't be 100% sure, but I believe the problem was in the jquery.metaData
plugin.
The fix has worked for me and 2 other people so far...

Here is the fix I posted on my blog, hope it helps. And if it does work for
you, then this is definitely what's been driving so many people crazy!

http://fyneworks.blogspot.com/2007/04/fix-for-jquery-bug-in-ie-working-with.html

= Fix for jQuery bug in IE - Working with XML documents =

It's been driving me crazy and I'm not alone (1, 2). But I've finally
managed to fix the weird jQuery bug in IE when working with XML documents
(or so I hope).

The bug isn't in jQuery itself, it's in the very popular Metadata plug-in,
used to load meta data and settings from elements using the class property.

The Error: Lines 101 - 105 in the Metadata plugin.
 if ( $.meta.single )
    this[ $.meta.single ] = data; // Throws error on XML documents in IE
 else
    $.extend( this, data ); // Throws error on XML documents in IE
this.metaDone = true; // Throws error on XML documents in IE


The fix: Find lines 75-77 in the Metadata plugin:
 $.fn.setArray = function(){
    return setArray.apply( this, arguments ).each(function(){
       if ( this.metaDone ) return;

And make the following change: (add line)
 $.fn.setArray = function(){
    return setArray.apply( this, arguments ).each(function(){
       try{ this['meta']=null; }catch(e){ return; } // Detect and trap error
       if ( this.metaDone ) return;

And that's it! This fix will allow Metadata to do what it does on HTML
elements and not throw that obscure "Object doesn't support this property or
method" error in Internet Explorer.


I just wanted to say thank you for posting this. I ran into the same problem when trying to get IE 7 to parse xml. I was also including the metadata plugin on the page and was unable to get the text from any xml nodes. I added the error catching code and it fixed the problem.

Thanks,
Marshall

Reply via email to