Re: [jQuery] XPath '[EMAIL PROTECTED]' doesn't work on XML documents
Mark Gibson wrote: John Resig wrote: Just a hunch, but IE's DOM support isn't native Javascript. If they got their typelib wrong it may be trying to call getAttribute rather than check elem for a getAttribute property. Can you replace that last line with this and see if it works? } else if ( typeof(elem.getAttribute) != undefined ) { Ok, this fixes one problem, but a further error occurs on line 641: return elem.getAttribute( name, 2 ); It appears that the getAttribute method on XML elements only accepts a single argument: return elem.getAttribute( name ); From the MS docs the second argument of 2 forces the method to be case-sensitive, which if I'm correct, isn't required by any browser other than IE. So is it possible to detect whether the browser is IE and the document is an HTML doc - in which case use the two args method, otherwise call with just one arg. Sorry, I got this wrong - it doesn't force case sensitive. According to the docs: 2 - Returns the value exactly as it was set in script or in the source document. Now I'm even more confused, what else would it return? - Mark. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] XPath '[EMAIL PROTECTED]' doesn't work on XML documents
Hello, I've come across a strange bug in IE: I've loaded an XML doc using $.get(), and selecting nodes using an XPath with a predicate containing an attribute: $([EMAIL PROTECTED], xml) IE just throws a wobbly: Line: 639 Error: Wrong number of arguments or invalid property assignment which appears to reside in the 'attr' function, the line is: } else if ( elem.getAttribute ) { as you see the message is a bit vague, i don't see a function call here or an attempt at assigning a property! I've attached demonstration files html/js/xml. (.js renamed to .jsx - as the mail server rejected it!!!) BTW, this works fine in Firefox, what a surprise! ;) Cheers - Mark Gibson (jQuery: r249) (IE: 6) Title: jQuery Testing Test Your Mum test data stuff=0/ data stuff=1/ /test $(function() { alert($([EMAIL PROTECTED]).length); // This works (shows: 2) $.get(selector.xml, function(xml) { alert($([EMAIL PROTECTED], xml).length); // This fails in IE }); }); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] XPath '[EMAIL PROTECTED]' doesn't work on XML documents
Mark Yes - I flagged this up a few days ago http://www.nabble.com/Searching-for-XML-attribute-tf2215205.html Link Here Still waiting for resolution - don't know if I need to raise a bug report... Ian Mark Gibson-8 wrote: Hello, I've come across a strange bug in IE: I've loaded an XML doc using $.get(), and selecting nodes using an XPath with a predicate containing an attribute: $([EMAIL PROTECTED], xml) IE just throws a wobbly: Line: 639 Error: Wrong number of arguments or invalid property assignment which appears to reside in the 'attr' function, the line is: } else if ( elem.getAttribute ) { as you see the message is a bit vague, i don't see a function call here or an attempt at assigning a property! I've attached demonstration files html/js/xml. (.js renamed to .jsx - as the mail server rejected it!!!) BTW, this works fine in Firefox, what a surprise! ;) Cheers - Mark Gibson (jQuery: r249) (IE: 6) jQuery Testing Test Your Mum test data stuff=0/ data stuff=1/ /test $(function() { alert($([EMAIL PROTECTED]).length); // This works (shows: 2) $.get(selector.xml, function(xml) { alert($([EMAIL PROTECTED], xml).length); // This fails in IE }); }); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/XPath-%27tag-%40att-%27-doesn%27t-work-on-XML-documents-tf2239741.html#a6211228 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] XPath '[EMAIL PROTECTED]' doesn't work on XML documents
IE just throws a wobbly: Line: 639 Error: Wrong number of arguments or invalid property assignment which appears to reside in the 'attr' function, the line is: } else if ( elem.getAttribute ) { Just a hunch, but IE's DOM support isn't native Javascript. If they got their typelib wrong it may be trying to call getAttribute rather than check elem for a getAttribute property. Can you replace that last line with this and see if it works? } else if ( typeof(elem.getAttribute) != undefined ) { ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] XPath '[EMAIL PROTECTED]' doesn't work on XML documents
Just a hunch, but IE's DOM support isn't native Javascript. If they got their typelib wrong it may be trying to call getAttribute rather than check elem for a getAttribute property. Can you replace that last line with this and see if it works? } else if ( typeof(elem.getAttribute) != undefined ) { I just committed this to SVN. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/