web/data/cubicweb.compat.js
author Julien Cristau <julien.cristau@logilab.fr>
Wed, 02 Jul 2014 15:11:00 +0200
changeset 9837 64c8ee99baf7
parent 9259 68cde7431c2c
permissions -rw-r--r--
[devtools/testlib,fill] use the new connection api (for auto_populate) Note that this changes API of CubicWebTC's custom_populate and post_populate methods to take a connection instead of a cursor, which may affect some cubes.

/**
 * .. function:: cw.utils.deprecatedFunction(msg, function)
 *
 * jQUery flattens arrays returned by the mapping function: ::
 *
 *   >>> y = ['a:b:c', 'd:e']
 *   >>> jQuery.map(y, function(y) { return y.split(':');})
 *   ["a", "b", "c", "d", "e"]
 *   // where one would expect:
 *   [ ["a", "b", "c"], ["d", "e"] ]
 */
 // XXX why not the same argument order as $.map and forEach ?

function map(func, array) {
    var result = [];
    for (var i = 0, length = array.length; i < length; i++) {
        result.push(func(array[i]));
    }
    return result;
}


// skm cube still uses this
getNodeAttribute = cw.utils.deprecatedFunction(
    '[3.9] getNodeAttribute(node, attr) is deprecated, use $(node).attr(attr)',
    function(node, attribute) {
        return $(node).attr(attribute);
    }
);