BibTemplate: make a couple of IE-friendly changes to BibTemplate.
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Dec 2010 19:40:47 +0000 (19:40 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Dec 2010 19:40:47 +0000 (19:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@18912 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/BibTemplate.js

index 4493941..a72ec16 100644 (file)
@@ -60,8 +60,8 @@ if(!dojo._hasResource["openils.BibTemplate"]) {
 
         textContent : function (node) {
             if (node) {
-                if (node instanceof HTMLElement) return node.innerText || node.textContent;
-                return dojox.xml.parser.textContent(node);
+                return node.innerText || node.textContent ||
+                    dojox.xml.parser.textContent(node) || "";
             }
             return '';
         },
@@ -153,7 +153,15 @@ if(!dojo._hasResource["openils.BibTemplate"]) {
                                     });
 
                                     if (debug) alert('BibTemplate debug -- template values:\n' + dojo.toJson( template_values ));
-                                    if (template_value_count > 0) slot.innerHTML = dojo.string.substitute( unescape(slot.innerHTML), template_values );
+                                    if (template_value_count > 0) {
+                                        dojo.attr(
+                                            slot, "innerHTML",
+                                            dojo.string.substitute(
+                                                unescape(slot.innerHTML),
+                                                template_values
+                                            )
+                                        );
+                                    }
                                 }
 
                                 var handler_node = dojo.query( '*[type="opac/slot-format"]', slot )[0];
@@ -165,7 +173,7 @@ if(!dojo._hasResource["openils.BibTemplate"]) {
                                     if (templated) {
                                         if (handler_node) handler_node.parentNode.replaceChild( dojo.doc.createTextNode( content ), handler_node );
                                     } else {
-                                        slot.innerHTML = content;
+                                        dojo.attr(slot, "innerHTML", content);
                                     }
                                 }