web/data/cubicweb.ajax.js
branchstable
changeset 2257 2c9eceeaae6a
parent 1801 672acc730ce5
child 2338 3f7c7fbae94e
equal deleted inserted replaced
2256:0b915d6f4264 2257:2c9eceeaae6a
     9 
     9 
    10 var JSON_BASE_URL = baseuri() + 'json?';
    10 var JSON_BASE_URL = baseuri() + 'json?';
    11 
    11 
    12 function _loadAjaxHtmlHead(node, head, tag, srcattr) {
    12 function _loadAjaxHtmlHead(node, head, tag, srcattr) {
    13     var loaded = [];
    13     var loaded = [];
    14     jQuery('head ' + tag).each(function(i) {
    14     var jqtagfilter = tag + '[' + srcattr + ']';
       
    15     jQuery('head ' + jqtagfilter).each(function(i) {
    15 	loaded.push(this.getAttribute(srcattr));
    16 	loaded.push(this.getAttribute(srcattr));
    16     });
    17     });
    17     node.find(tag).each(function(i) {
    18     node.find(tag).each(function(i) {
    18 	if (!loaded.contains(this.getAttribute(srcattr))) {
    19 	if (this.getAttribute(srcattr)) {
       
    20 	    if (!loaded.contains(this.getAttribute(srcattr))) {
       
    21 		jQuery(this).appendTo(head);
       
    22 	    }
       
    23 	} else {
    19 	    jQuery(this).appendTo(head);
    24 	    jQuery(this).appendTo(head);
    20 	}
    25 	}
    21     });
    26     });
    22     node.find(tag).remove();
    27     node.find(jqtagfilter).remove();
    23 }
    28 }
    24 
    29 
    25 /*
    30 /*
    26  * inspect dom response, search for a <div class="ajaxHtmlHead"> node and
    31  * inspect dom response, search for a <div class="ajaxHtmlHead"> node and
    27  * put its content into the real document's head.
    32  * put its content into the real document's head.