From: miker Date: Wed, 29 Sep 2010 20:16:41 +0000 (+0000) Subject: Give BibTemplate the ability to inspect and optionally parse XML, instead of requirin... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=66a33803f1dfcd08502f49fe9f51c968e702d16e;p=contrib%2FConifer.git Give BibTemplate the ability to inspect and optionally parse XML, instead of requiring a DOM node git-svn-id: svn://svn.open-ils.org/ILS/trunk@18105 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/BibTemplate.js b/Open-ILS/web/js/dojo/openils/BibTemplate.js index 88e2bff868..c9e9c929e2 100644 --- a/Open-ILS/web/js/dojo/openils/BibTemplate.js +++ b/Open-ILS/web/js/dojo/openils/BibTemplate.js @@ -36,6 +36,9 @@ if(!dojo._hasResource["openils.BibTemplate"]) { this.locale = kwargs.locale || OpenSRF.locale || 'en-US'; this.nodelay = kwargs.delay == false; + if (this.xml && this.xml instanceof String) + this.xml = dojox.xml.parser.parse(this.xml); + this.mode = 'biblio-record_entry'; this.default_datatype = 'marcxml-uris'; if (kwargs.metarecord) { @@ -56,12 +59,11 @@ if(!dojo._hasResource["openils.BibTemplate"]) { }, textContent : function (node) { - var content = ''; if (node) { - if(window.ActiveXObject) content = node.text; - else content = node.textContent; + if (node instanceof HTMLElement) return node.innerText || node.textContent; + return dojox.xml.parser.textContent(node); } - return content; + return ''; }, render : function() {