On Apr 7, 2:42 am, Ariel Jakobovits <[EMAIL PROTECTED]> wrote: > Did you contribute this back to the Metadata community? Where is the Metadata community???
> ----- Original Message ---- > From: Diego A. <[EMAIL PROTECTED]> > To: jquery-en@googlegroups.com > Sent: Friday, April 6, 2007 3:54:52 PM > Subject: [jQuery] Re: IE XML parsing problem > > 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-workin... > > = 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. > > Angelo Sozzi wrote: > > > Hi, > > > I've managed to finish my first plugin and re-learn javascript at the same > > time. So I'm not quite sure if this is a Javascript or jQuery issue. > > > The plugin loads external content from HTML or XML data using an AJAX call > > to the file name generated from the LI element clicked. > > DEMO:http://www.sozzi.cn/jquery/fish.fn.trial3.html > > > It works perfectly for the HTML variant but the XML fails in IE throwing a > > " Object doesn't support this property or method" error. > > It seems to happen in the XML call and parse function on the line finding > > the "link" within the XML object: > > > (snip)... > > $.get(XMLurl, function(xml){ > > $("site", xml).each(function(){ // step through each > > 'site' > > xml node > > $(this).find("link").each(function(){ // find 'link' insidet the > > 'site' node and turn it into html > > settings.parsedXML += "<div class='link'> > > "+$(this).text()+" "; > > ....(snip) > > > Any thoughts on what I'm doing wrong? > > > js: > > /* > > * AZlinker 0.4 Beta > > * By Angelo Sozzi (http://www.sozzi.cn/jQuery) > > * A jQuery plugin that will load XML or HTML links into divs > > * by maping the UL>LI element names to filenames > > * Demo athttp://www.sozzi.cn/jQuery/a_zlink.html > > */ > > > $.fn.AZlinker = function(settings) { > > var settings = $.extend({ > > targetID: "#xml_here", > > elemname: "li", > > methodXML: true, > > parsedXML: "" > > }, settings || {}); // overwrite settings if there are any given in > > the function call > > // other plugin code > > $("#busy").hide(); > > var list = $(this).find(settings.elemname) > > list.hover( > > function(){ $(this).next().addClass("medium"); > > $(this).prev().addClass("medium"); > > $(this).addClass("large");}, > > function(){ $(this).next().removeClass("medium"); > > $(this).prev().removeClass("medium"); > > $(this).removeClass("large");} > > ); > > // make clicked li active, read html and use to retrieve html or xml > > list.click(function(){ //Add an OnClick event to all <li> > > list.removeClass("active"); //OnClick Remove the active class > > from all > > li > > $(this).addClass("active"); //Add class=active to clicked li > > if (settings.methodXML){ > > var XMLurl = "xml/"+$.trim($(this).text())+".xml"; //Read out > > text > > from litext li and make filename from it > > loadXML(XMLurl); > > } > > else { > > HTMLurl = "html/"+$.trim($(this).text())+".html"; //read out text > > from > > litext li and make filename from it > > $(settings.targetID).load(HTMLurl); //trim is used because > > text leaves > > a space in IE > > } > > }); > > // Helper funtions > > // The Ajax XML call and parsing to html > > function loadXML(XMLurl){ > > settings.parsedXML=""; > > $.get(XMLurl, function(xml){ > > $("site", xml).each(function(){ // step through each > > 'site' > > xml node > > $(this).find("link").each(function(){ // find 'link' insidet the > > 'site' node and turn it into html > > settings.parsedXML += "<div class='link'> > > "+$(this).text()+" "; > > }).end().find("description").each(function(){ > > settings.parsedXML += $(this).text()+ " </div>"; > > }); > > $(settings.targetID).html(settings.parsedXML); > > }); > > }); > > }; > > // don't break the chain > > return this; > > }; // end jQuery plugin > > -- > View this message in > context:http://www.nabble.com/IE-XML-parsing-problem-tf2469241s15494.html#a98... > Sent from the JQuery mailing list archive at Nabble.com.