...
...
| Code Block |
|---|
|
FS = {};
FR = {};
contentPane = {}; |
...
| Code Block |
|---|
|
window.FS = {};
window.FR= {};
window.contentPane = {}; |
错误:
...
FR.ajax()函数会对data自动进行编码,避免了参数编码错误错误:
| Code Block |
|---|
|
$.ajax({
url : "http://www.baidu.com",
data: {"keywords": "中文"},
success : function() {
// do something
}
}); |
...
...
|
FR.ajax({
url : "http://www.baidu.com",
data: {"keywords": "中文"},
success : function() {
// do something
}
}); |
以下划线标记私有方法增加代码的可读性。错误:
| Code Block |
|---|
|
FR.Button = FR.extend(FR.Widget, |
...
{
defaultConfig: function () {
return {cls : 'fr-btn'};
}
}; |
...
| Code Block |
|---|
|
FR.Button = FR.extend(FR.Widget, |
...
{
_defaultConfig: function () {
return {cls : 'fr-btn'};
}
}; |
前者的函数存在浏览器兼容问题,低版本的IE是不支持的。错误:
| Code Block |
|---|
|
var date = new Date("2014-01-01"); |
...
| Code Block |
|---|
|
var date = new Date(2014, 1,1); |