web/data/cubicweb.compat.js
changeset 11057 0b59724cb3f2
parent 11052 058bb3dc685f
child 11058 23eb30449fe5
equal deleted inserted replaced
11052:058bb3dc685f 11057:0b59724cb3f2
     1 /**
       
     2  * .. function:: cw.utils.deprecatedFunction(msg, function)
       
     3  *
       
     4  * jQUery flattens arrays returned by the mapping function: ::
       
     5  *
       
     6  *   >>> y = ['a:b:c', 'd:e']
       
     7  *   >>> jQuery.map(y, function(y) { return y.split(':');})
       
     8  *   ["a", "b", "c", "d", "e"]
       
     9  *   // where one would expect:
       
    10  *   [ ["a", "b", "c"], ["d", "e"] ]
       
    11  */
       
    12  // XXX why not the same argument order as $.map and forEach ?
       
    13 
       
    14 function map(func, array) {
       
    15     var result = [];
       
    16     for (var i = 0, length = array.length; i < length; i++) {
       
    17         result.push(func(array[i]));
       
    18     }
       
    19     return result;
       
    20 }
       
    21 
       
    22 
       
    23 // skm cube still uses this
       
    24 getNodeAttribute = cw.utils.deprecatedFunction(
       
    25     '[3.9] getNodeAttribute(node, attr) is deprecated, use $(node).attr(attr)',
       
    26     function(node, attribute) {
       
    27         return $(node).attr(attribute);
       
    28     }
       
    29 );