[FIX] remove trailing commas in object literals

bzr revid: xmo@openerp.com-20110617091344-mlal79a9poagjwm3
This commit is contained in:
Xavier Morel 2011-06-17 11:13:44 +02:00
parent ceda49fbad
commit 7ed58deec7
2 changed files with 32 additions and 2 deletions

View File

@ -283,7 +283,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
marker:{
type:"round",
width:12
},
}
}
});
for (var i = 1; i<self.group_list.length;i++){
@ -373,7 +373,7 @@ openerp.base_graph.GraphView = openerp.base.Controller.extend({
self.load_chart(response);
});
});
},
}
});

View File

@ -22,6 +22,13 @@ Coding issues and coding conventions
Javascript coding
~~~~~~~~~~~~~~~~~
These are a number of guidelines for javascript code. More than coding
conventions, these are warnings against potentially harmful or sub-par
constructs.
Ideally, you should be able to configure your editor or IDE to warn you against
these kinds of issues.
Use ``var`` for *all* declarations
**********************************
@ -53,6 +60,29 @@ All local *and global* variables should be declared via ``var``.
page (because it's used in embedded mode) each instance will have its
own internal but global-to-its-objects data.
Do not leave trailing commas in object literals
***********************************************
While it is legal to leave trailing commas in Python dictionaries, e.g.
::
foo = {
'a': 1,
'b': 2,
}
and it's valid in ECMAScript 5 and most browsers support it in Javascript, you
should *never* use trailing commas in Javascript object literals:
* Internet Explorer does *not* support trailing commas (at least until and
including Internet Explorer 8), and trailing comma will cause hard-to-debug
errors in it
* JSON does not accept trailing comma (it is a syntax error), and using them
in object literals puts you at risks of using them in literal JSON strings
as well (though there are few reasons to write JSON by hand)
Writing documentation
+++++++++++++++++++++