diff options
| author | Igor Minar | 2011-03-26 16:06:38 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-03-26 23:19:04 -0700 |
| commit | 1e59822df7366094dbf38b0c4ce0cc979258ad19 (patch) | |
| tree | f171a959e390bda54988369eb634dfd5dc73e30a /src/widgets.js | |
| parent | d95a6925cdb5e8009b11fe3ce6dcc8d579bb4234 (diff) | |
| download | angular.js-1e59822df7366094dbf38b0c4ce0cc979258ad19.tar.bz2 | |
remove _null and _undefined
they have no significant effect on minified and gziped size. in fact
they make things worse.
file | before | after removal
----------------------------------------
concat | 325415 | 325297
min | 62070 | 62161
min + gzip | 25187 | 25176
The bottom line is that we are getting 0.05% decrease in size after
gzip without all of the hassle of using underscores everywhere.
Diffstat (limited to 'src/widgets.js')
| -rw-r--r-- | src/widgets.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets.js b/src/widgets.js index 91b0fcf2..ac8a88e0 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -148,7 +148,7 @@ function modelAccessor(scope, element) { return scope.$eval(expr); }, set: function(value) { - if (value !== _undefined) { + if (value !== undefined) { return scope.$tryEval(function(){ assign(scope, value); }, element); @@ -310,7 +310,7 @@ function valueAccessor(scope, element) { return { get: function(){ if (lastError) - elementError(element, NG_VALIDATION_ERROR, _null); + elementError(element, NG_VALIDATION_ERROR, null); try { var value = parse(scope, element.val()); validate(); @@ -333,13 +333,13 @@ function valueAccessor(scope, element) { function validate() { var value = trim(element.val()); if (element[0].disabled || element[0].readOnly) { - elementError(element, NG_VALIDATION_ERROR, _null); + elementError(element, NG_VALIDATION_ERROR, null); invalidWidgets.markValid(element); } else { var error, validateScope = inherit(scope, {$element:element}); error = required && !value ? 'Required' - : (value ? validator(validateScope, value) : _null); + : (value ? validator(validateScope, value) : null); elementError(element, NG_VALIDATION_ERROR, error); lastError = error; if (error) { @@ -367,7 +367,7 @@ function radioAccessor(scope, element) { var domElement = element[0]; return { get: function(){ - return domElement.checked ? domElement.value : _null; + return domElement.checked ? domElement.value : null; }, set: function(value){ domElement.checked = value == domElement.value; @@ -425,7 +425,7 @@ var textWidget = inputWidget('keydown change', modelAccessor, valueAccessor, ini 'image': buttonWidget, 'checkbox': inputWidget('click', modelFormattedAccessor, checkedAccessor, initWidgetValue(false)), 'radio': inputWidget('click', modelFormattedAccessor, radioAccessor, radioInit), - 'select-one': inputWidget('change', modelAccessor, valueAccessor, initWidgetValue(_null)), + 'select-one': inputWidget('change', modelAccessor, valueAccessor, initWidgetValue(null)), 'select-multiple': inputWidget('change', modelAccessor, optionsAccessor, initWidgetValue([])) // 'file': fileWidget??? }; @@ -448,9 +448,9 @@ function radioInit(model, view, element) { input.checked = false; input.name = this.$id + '@' + input.name; if (isUndefined(modelValue)) { - model.set(modelValue = _null); + model.set(modelValue = null); } - if (modelValue == _null && viewValue !== _null) { + if (modelValue == null && viewValue !== null) { model.set(viewValue); } view.set(modelValue); |
