web/data/cubicweb.js
changeset 9259 68cde7431c2c
parent 8129 2dedcc15208d
child 9284 4c37808fd284
equal deleted inserted replaced
9258:4e79f587c6ab 9259:68cde7431c2c
   101     deprecatedFunction: function (msg, newfunc) {
   101     deprecatedFunction: function (msg, newfunc) {
   102         return function () {
   102         return function () {
   103             cw.log(msg);
   103             cw.log(msg);
   104             return newfunc.apply(this, arguments);
   104             return newfunc.apply(this, arguments);
   105         };
   105         };
   106     },
       
   107 
       
   108     movedToNamespace: function (funcnames, namespace) {
       
   109         for (var i = 0; i < funcnames.length; i++) {
       
   110             var funcname = funcnames[i];
       
   111             var msg = ('[3.9] ' + funcname + ' is deprecated, use ' +
       
   112 		       namespace.__name__ + '.' + funcname + ' instead');
       
   113             window[funcname] = cw.utils.deprecatedFunction(msg, namespace[funcname]);
       
   114         }
       
   115     },
   106     },
   116 
   107 
   117     createDomFunction: function (tag) {
   108     createDomFunction: function (tag) {
   118         function builddom(params, children) {
   109         function builddom(params, children) {
   119             var node = document.createElement(tag);
   110             var node = document.createElement(tag);
   386 		    );
   377 		    );
   387     }
   378     }
   388 
   379 
   389 });
   380 });
   390 
   381 
   391 String.prototype.startsWith = cw.utils.deprecatedFunction('[3.9] str.startsWith() is deprecated, use str.startswith() instead', function (prefix) {
       
   392     return this.startswith(prefix);
       
   393 });
       
   394 
       
   395 String.prototype.endsWith = cw.utils.deprecatedFunction('[3.9] str.endsWith() is deprecated, use str.endswith() instead', function (suffix) {
       
   396     return this.endswith(prefix);
       
   397 });
       
   398 
       
   399 /** DOM factories ************************************************************/
   382 /** DOM factories ************************************************************/
   400 A = cw.utils.createDomFunction('a');
   383 A = cw.utils.createDomFunction('a');
   401 BUTTON = cw.utils.createDomFunction('button');
   384 BUTTON = cw.utils.createDomFunction('button');
   402 BR = cw.utils.createDomFunction('br');
   385 BR = cw.utils.createDomFunction('br');
   403 CANVAS = cw.utils.createDomFunction('canvas');
   386 CANVAS = cw.utils.createDomFunction('canvas');
   470         }
   453         }
   471     }
   454     }
   472     return node;
   455     return node;
   473 }
   456 }
   474 
   457 
   475 // XXX avoid crashes / backward compat
   458 // cubes: tag, keyword and apycot seem to use this, including require/provide
       
   459 // backward compat
   476 CubicWeb = cw;
   460 CubicWeb = cw;
   477 
   461 
   478 jQuery.extend(cw, {
   462 jQuery.extend(cw, {
   479     require: cw.utils.deprecatedFunction(
   463     require: cw.utils.deprecatedFunction(
   480         '[3.9] CubicWeb.require() is not used anymore',
   464         '[3.9] CubicWeb.require() is not used anymore',