fix w/ tags without src/href stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 03 Jul 2009 17:58:36 +0200
branchstable
changeset 2257 2c9eceeaae6a
parent 2256 0b915d6f4264
child 2258 79bc598c6411
fix w/ tags without src/href
web/data/cubicweb.ajax.js
--- a/web/data/cubicweb.ajax.js	Fri Jul 03 17:57:33 2009 +0200
+++ b/web/data/cubicweb.ajax.js	Fri Jul 03 17:58:36 2009 +0200
@@ -11,15 +11,20 @@
 
 function _loadAjaxHtmlHead(node, head, tag, srcattr) {
     var loaded = [];
-    jQuery('head ' + tag).each(function(i) {
+    var jqtagfilter = tag + '[' + srcattr + ']';
+    jQuery('head ' + jqtagfilter).each(function(i) {
 	loaded.push(this.getAttribute(srcattr));
     });
     node.find(tag).each(function(i) {
-	if (!loaded.contains(this.getAttribute(srcattr))) {
+	if (this.getAttribute(srcattr)) {
+	    if (!loaded.contains(this.getAttribute(srcattr))) {
+		jQuery(this).appendTo(head);
+	    }
+	} else {
 	    jQuery(this).appendTo(head);
 	}
     });
-    node.find(tag).remove();
+    node.find(jqtagfilter).remove();
 }
 
 /*