diff options
| author | Misko Hevery | 2011-02-12 08:58:11 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-02-16 08:59:57 -0500 | 
| commit | cdc093a463e8f8a925cbb9f2b55bedf0a1d8e7e8 (patch) | |
| tree | c481c1b86986f156646eafc9d0ec4db852edb455 /src | |
| parent | 00cc9eb32a9387040d0175fcfd21cf9dcab6514f (diff) | |
| download | angular.js-cdc093a463e8f8a925cbb9f2b55bedf0a1d8e7e8.tar.bz2 | |
reformated multiline trinary expressions to have a leading ?/:.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 28 | ||||
| -rw-r--r-- | src/apis.js | 5 | ||||
| -rw-r--r-- | src/directives.js | 20 | ||||
| -rw-r--r-- | src/jqLite.js | 12 | ||||
| -rw-r--r-- | src/parser.js | 17 | ||||
| -rw-r--r-- | src/scenario/Scenario.js | 6 | ||||
| -rw-r--r-- | src/validators.js | 5 | ||||
| -rw-r--r-- | src/widgets.js | 12 | 
8 files changed, 57 insertions, 48 deletions
| diff --git a/src/Angular.js b/src/Angular.js index 99a4528d..87be29a7 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -30,12 +30,14 @@ var uppercase = function (string){ return isString(string) ? string.toUpperCase(  var manualLowercase = function (s) { -  return isString(s) ? s.replace(/[A-Z]/g, -      function (ch) {return fromCharCode(ch.charCodeAt(0) | 32); }) : s; +  return isString(s) +      ? s.replace(/[A-Z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) | 32); }) +      : s;  };  var manualUppercase = function (s) { -  return isString(s) ? s.replace(/[a-z]/g, -      function (ch) {return fromCharCode(ch.charCodeAt(0) & ~32); }) : s; +  return isString(s) +      ? s.replace(/[a-z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) & ~32); }) +      : s;  }; @@ -89,7 +91,9 @@ var _undefined        = undefined,      jQuery,           // delay binding      slice             = Array.prototype.slice,      push              = Array.prototype.push, -    error             = window[$console] ? bind(window[$console], window[$console]['error'] || noop) : noop, +    error             = window[$console] +                           ? bind(window[$console], window[$console]['error'] || noop) +                           : noop,      /** @name angular */      angular           = window[$angular] || (window[$angular] = {}), @@ -417,13 +421,13 @@ function isElement(node) {   */  function HTML(html, option) {    this.html = html; -  this.get = lowercase(option) == 'unsafe' ? -    valueFn(html) : -    function htmlSanitize() { -      var buf = []; -      htmlParser(html, htmlSanitizeWriter(buf)); -      return buf.join(''); -    }; +  this.get = lowercase(option) == 'unsafe' +    ? valueFn(html) +    : function htmlSanitize() { +        var buf = []; +        htmlParser(html, htmlSanitizeWriter(buf)); +        return buf.join(''); +      };  }  if (msie) { diff --git a/src/apis.js b/src/apis.js index 437cd6e0..6435affb 100644 --- a/src/apis.js +++ b/src/apis.js @@ -637,8 +637,9 @@ var angularArray = {        return 0;      }      function reverse(comp, descending) { -      return toBoolean(descending) ? -          function(a,b){return comp(b,a);} : comp; +      return toBoolean(descending) +          ? function(a,b){return comp(b,a);} +          : comp;      }      function compare(v1, v2){        var t1 = typeof v1; diff --git a/src/directives.js b/src/directives.js index 06a99149..53601a4f 100644 --- a/src/directives.js +++ b/src/directives.js @@ -243,15 +243,17 @@ function compileBindTemplate(template){      var bindings = [];      forEach(parseBindings(template), function(text){        var exp = binding(text); -      bindings.push(exp ? function(element){ -        var error, value = this.$tryEval(exp, function(e){ -          error = toJson(e); -        }); -        elementError(element, NG_EXCEPTION, error); -        return error ? error : value; -      } : function() { -        return text; -      }); +      bindings.push(exp +        ? function(element){ +            var error, value = this.$tryEval(exp, function(e){ +              error = toJson(e); +            }); +            elementError(element, NG_EXCEPTION, error); +            return error ? error : value; +          } +        : function() { +            return text; +          });      });      bindTemplateCache[template] = fn = function(element, prettyPrintJson){        var parts = [], self = this, diff --git a/src/jqLite.js b/src/jqLite.js index 40994161..8a507212 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -5,12 +5,12 @@  var jqCache = {},      jqName = 'ng-' + new Date().getTime(),      jqId = 1, -    addEventListenerFn = (window.document.addEventListener ? -      function(element, type, fn) {element.addEventListener(type, fn, false);} : -      function(element, type, fn) {element.attachEvent('on' + type, fn);}), -    removeEventListenerFn = (window.document.removeEventListener ? -      function(element, type, fn) {element.removeEventListener(type, fn, false); } : -      function(element, type, fn) {element.detachEvent('on' + type, fn); }); +    addEventListenerFn = (window.document.addEventListener +      ? function(element, type, fn) {element.addEventListener(type, fn, false);} +      : function(element, type, fn) {element.attachEvent('on' + type, fn);}), +    removeEventListenerFn = (window.document.removeEventListener +      ? function(element, type, fn) {element.removeEventListener(type, fn, false); } +      : function(element, type, fn) {element.detachEvent('on' + type, fn); });  function jqNextId() { return (jqId++); } diff --git a/src/parser.js b/src/parser.js index f2ca7a80..a8bd21e4 100644 --- a/src/parser.js +++ b/src/parser.js @@ -107,9 +107,9 @@ function lex(text, parseStringsForObjects){    function throwError(error, start, end) {      end = end || index;      throw Error("Lexer Error: " + error + " at column" + -        (isDefined(start) ? -            "s " + start +  "-" + index + " [" + text.substring(start, end) + "]" : -            " " + end) + +        (isDefined(start) +            ? "s " + start +  "-" + index + " [" + text.substring(start, end) + "]" +            : " " + end) +          " in expression [" + text + "].");    } @@ -199,8 +199,9 @@ function lex(text, parseStringsForObjects){          index++;          tokens.push({index:start, text:rawString, string:string, json:true,            fn:function(){ -            return (string.length == dateParseLength) ? -              angular['String']['toDate'](string) : string; +            return (string.length == dateParseLength) +              ? angular['String']['toDate'](string) +              : string;            }});          return;        } else { @@ -588,9 +589,9 @@ function parser(text, json){        }        var fnPtr = fn(self) || noop;        // IE stupidity! -      return fnPtr.apply ? -          fnPtr.apply(self, args) : -            fnPtr(args[0], args[1], args[2], args[3], args[4]); +      return fnPtr.apply +          ? fnPtr.apply(self, args) +          : fnPtr(args[0], args[1], args[2], args[3], args[4]);      };    } diff --git a/src/scenario/Scenario.js b/src/scenario/Scenario.js index 81c85a61..a70948cc 100644 --- a/src/scenario/Scenario.js +++ b/src/scenario/Scenario.js @@ -309,9 +309,9 @@ function browserTrigger(element, type) {   */  _jQuery.fn.bindings = function(name) {    function contains(text, value) { -    return value instanceof RegExp ? -      value.test(text) : -      text && text.indexOf(value) >= 0; +    return value instanceof RegExp +      ? value.test(text) +      : text && text.indexOf(value) >= 0;    }    var result = [];    this.find('.ng-binding:visible').each(function() { diff --git a/src/validators.js b/src/validators.js index e2a9d7f6..265d95de 100644 --- a/src/validators.js +++ b/src/validators.js @@ -181,8 +181,9 @@ extend(angularValidator, {      return (date &&              date.getFullYear() == fields[3] &&              date.getMonth() == fields[1]-1 && -            date.getDate() == fields[2]) ? -              _null : "Value is not a date. (Expecting format: 12/31/2009)."; +            date.getDate() == fields[2]) +              ? _null  +              : "Value is not a date. (Expecting format: 12/31/2009).";    },    /** diff --git a/src/widgets.js b/src/widgets.js index 14d6fe10..ce877c71 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -337,9 +337,9 @@ function valueAccessor(scope, element) {        invalidWidgets.markValid(element);      } else {        var error, validateScope = inherit(scope, {$element:element}); -      error = required && !value ? -              'Required' : -              (value ? validator(validateScope, value) : _null); +      error = required && !value +              ? 'Required' +              : (value ? validator(validateScope, value) : _null);        elementError(element, NG_VALIDATION_ERROR, error);        lastError = error;        if (error) { @@ -940,9 +940,9 @@ angularWidget("@ng:repeat", function(expression, element){              childScope[valueIdent] = collection[key];              if (keyIdent) childScope[keyIdent] = key;              childScope.$index = index; -            childScope.$position = index == 0 ? -                'first' : -                  (index == collectionLength - 1 ? 'last' : 'middle'); +            childScope.$position = index == 0 +                ? 'first' +                : (index == collectionLength - 1 ? 'last' : 'middle');              lastElement.after(cloneElement = element.cloneNode());              cloneElement.attr('ng:repeat-index', index);              linker(childScope, cloneElement); | 
