From: Jakub Skoczen Date: Wed, 12 Mar 2008 11:36:57 +0000 (+0000) Subject: FIXED: pz2.js would break in IE because the DOMElement is missing hasAttributes metho... X-Git-Tag: PAZPAR2.1.0.6~3 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=b105666b770081807a7af0846f87906641c10a79;p=pazpar2-moved-to-github.git FIXED: pz2.js would break in IE because the DOMElement is missing hasAttributes method. (bug #2103) --- diff --git a/js/pz2.js b/js/pz2.js index 21990d0..94d83ae 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -1,5 +1,5 @@ /* -** $Id: pz2.js,v 1.69 2008-02-14 12:20:24 jakub Exp $ +** $Id: pz2.js,v 1.70 2008-03-12 11:36:57 jakub Exp $ ** pz2.js - pazpar2's javascript client library. */ @@ -933,18 +933,16 @@ Element_parseChildNodes = function (node) } } - if (node.hasAttributes()) { - var attrs = node.attributes; - for (var i = 0; i < attrs.length; i++) { - var attrName = '@' + attrs[i].nodeName; - var attrValue = attrs[i].nodeValue; - parsed[attrName] = attrValue; - } + var attrs = node.attributes; + for (var i = 0; i < attrs.length; i++) { + var attrName = '@' + attrs[i].nodeName; + var attrValue = attrs[i].nodeValue; + parsed[attrName] = attrValue; } // if no nested elements, get text content if (node.hasChildNodes() && !hasChildElems) { - if (node.hasAttributes()) + if (node.attributes.length) parsed['textContent'] = node.firstChild.nodeValue; else parsed = node.firstChild.nodeValue;