web/data/cubicweb.ajax.js
branchstable
changeset 2257 2c9eceeaae6a
parent 1801 672acc730ce5
child 2338 3f7c7fbae94e
--- 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();
 }
 
 /*