Added strict mode and es3 mode to framework and corrected some problems
bzr revid: nicolas.vanhoren@openerp.com-20130729092512-1ip4abjrypf74qr2
This commit is contained in:
parent
4157b860bc
commit
22ac3304e1
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4.1",
|
"grunt": "*",
|
||||||
"grunt-contrib-jshint": "~0.6.0"
|
"grunt-contrib-jshint": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
var fct = openerp[modules[i]];
|
var fct = openerp[modules[i]];
|
||||||
if (typeof(fct) === "function") {
|
if (typeof(fct) === "function") {
|
||||||
openerp[modules[i]] = {};
|
openerp[modules[i]] = {};
|
||||||
for (k in fct) {
|
for (var k in fct) {
|
||||||
openerp[modules[i]][k] = fct[k];
|
openerp[modules[i]][k] = fct[k];
|
||||||
}
|
}
|
||||||
fct(openerp, openerp[modules[i]]);
|
fct(openerp, openerp[modules[i]]);
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
var fct = openerp.web[files[i]];
|
var fct = openerp.web[files[i]];
|
||||||
if(typeof(fct) === "function") {
|
if(typeof(fct) === "function") {
|
||||||
openerp.web[files[i]] = {};
|
openerp.web[files[i]] = {};
|
||||||
for (k in fct) {
|
for (var k in fct) {
|
||||||
openerp.web[files[i]][k] = fct[k];
|
openerp.web[files[i]][k] = fct[k];
|
||||||
}
|
}
|
||||||
fct(openerp, openerp.web[files[i]]);
|
fct(openerp, openerp.web[files[i]]);
|
||||||
|
|
|
@ -253,7 +253,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
|
||||||
var fct = instance._openerp[mod];
|
var fct = instance._openerp[mod];
|
||||||
if(typeof(fct) === "function") {
|
if(typeof(fct) === "function") {
|
||||||
instance._openerp[mod] = {};
|
instance._openerp[mod] = {};
|
||||||
for (k in fct) {
|
for (var k in fct) {
|
||||||
instance._openerp[mod][k] = fct[k];
|
instance._openerp[mod][k] = fct[k];
|
||||||
}
|
}
|
||||||
fct(instance, instance._openerp[mod]);
|
fct(instance, instance._openerp[mod]);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
/* jshint es3: true */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
function declare($, _, QWeb2) {
|
function declare($, _, QWeb2) {
|
||||||
var openerp = {};
|
var openerp = {};
|
||||||
|
@ -72,7 +74,8 @@ openerp.web = {};
|
||||||
// Instantiate a web class (but only create the instance,
|
// Instantiate a web class (but only create the instance,
|
||||||
// don't run the init constructor)
|
// don't run the init constructor)
|
||||||
initializing = true;
|
initializing = true;
|
||||||
var prototype = new this();
|
var This = this;
|
||||||
|
var prototype = new This();
|
||||||
initializing = false;
|
initializing = false;
|
||||||
|
|
||||||
// Copy the properties over onto the new prototype
|
// Copy the properties over onto the new prototype
|
||||||
|
@ -148,7 +151,7 @@ openerp.web = {};
|
||||||
Class.constructor = Class;
|
Class.constructor = Class;
|
||||||
|
|
||||||
// And make this class extendable
|
// And make this class extendable
|
||||||
Class.extend = arguments.callee;
|
Class.extend = this.extend;
|
||||||
|
|
||||||
return Class;
|
return Class;
|
||||||
};
|
};
|
||||||
|
@ -756,20 +759,20 @@ openerp.web.Widget = openerp.web.Class.extend(openerp.web.PropertiesMixin, {
|
||||||
var fn = (typeof method === 'string') ? self[method] : method;
|
var fn = (typeof method === 'string') ? self[method] : method;
|
||||||
return fn.apply(self, arguments);
|
return fn.apply(self, arguments);
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.qweb = new QWeb2.Engine();
|
openerp.web.qweb = new QWeb2.Engine();
|
||||||
|
|
||||||
openerp.web.qweb.default_dict = {
|
openerp.web.qweb.default_dict = {
|
||||||
'_' : _,
|
'_' : _,
|
||||||
'JSON': JSON,
|
'JSON': JSON
|
||||||
};
|
};
|
||||||
|
|
||||||
openerp.declare = declare;
|
openerp.declare = declare;
|
||||||
|
|
||||||
return openerp;
|
return openerp;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (typeof(define) !== "undefined") { // amd
|
if (typeof(define) !== "undefined") { // amd
|
||||||
define(["jquery", "underscore", "qweb2"], declare);
|
define(["jquery", "underscore", "qweb2"], declare);
|
||||||
|
|
Loading…
Reference in New Issue