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:
niv-openerp 2013-07-29 11:25:12 +02:00
parent 4157b860bc
commit 22ac3304e1
4 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.0"
"grunt": "*",
"grunt-contrib-jshint": "*"
}
}
}

View File

@ -40,7 +40,7 @@
var fct = openerp[modules[i]];
if (typeof(fct) === "function") {
openerp[modules[i]] = {};
for (k in fct) {
for (var k in fct) {
openerp[modules[i]][k] = fct[k];
}
fct(openerp, openerp[modules[i]]);
@ -60,7 +60,7 @@
var fct = openerp.web[files[i]];
if(typeof(fct) === "function") {
openerp.web[files[i]] = {};
for (k in fct) {
for (var k in fct) {
openerp.web[files[i]][k] = fct[k];
}
fct(openerp, openerp.web[files[i]]);

View File

@ -253,7 +253,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
var fct = instance._openerp[mod];
if(typeof(fct) === "function") {
instance._openerp[mod] = {};
for (k in fct) {
for (var k in fct) {
instance._openerp[mod][k] = fct[k];
}
fct(instance, instance._openerp[mod]);

View File

@ -1,5 +1,7 @@
(function() {
/* jshint es3: true */
"use strict";
function declare($, _, QWeb2) {
var openerp = {};
@ -72,7 +74,8 @@ openerp.web = {};
// Instantiate a web class (but only create the instance,
// don't run the init constructor)
initializing = true;
var prototype = new this();
var This = this;
var prototype = new This();
initializing = false;
// Copy the properties over onto the new prototype
@ -148,7 +151,7 @@ openerp.web = {};
Class.constructor = Class;
// And make this class extendable
Class.extend = arguments.callee;
Class.extend = this.extend;
return Class;
};
@ -756,20 +759,20 @@ openerp.web.Widget = openerp.web.Class.extend(openerp.web.PropertiesMixin, {
var fn = (typeof method === 'string') ? self[method] : method;
return fn.apply(self, arguments);
};
},
}
});
openerp.web.qweb = new QWeb2.Engine();
openerp.web.qweb.default_dict = {
'_' : _,
'JSON': JSON,
'JSON': JSON
};
openerp.declare = declare;
return openerp;
};
}
if (typeof(define) !== "undefined") { // amd
define(["jquery", "underscore", "qweb2"], declare);