diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 26 | ||||
| -rw-r--r-- | src/Browser.js | 6 | ||||
| -rw-r--r-- | src/Injector.js | 2 | ||||
| -rw-r--r-- | src/Resource.js | 2 | ||||
| -rw-r--r-- | src/Scope.js | 4 | ||||
| -rw-r--r-- | src/angular-mocks.js | 16 | ||||
| -rw-r--r-- | src/angular.suffix | 2 | ||||
| -rw-r--r-- | src/apis.js | 16 | ||||
| -rw-r--r-- | src/directives.js | 42 | ||||
| -rw-r--r-- | src/filters.js | 26 | ||||
| -rw-r--r-- | src/jqLite.js | 2 | ||||
| -rw-r--r-- | src/parser.js | 48 | ||||
| -rw-r--r-- | src/sanitizer.js | 2 | ||||
| -rw-r--r-- | src/scenario/Scenario.js | 2 | ||||
| -rw-r--r-- | src/scenario/angular-bootstrap.js | 4 | ||||
| -rw-r--r-- | src/service/cookies.js | 2 | ||||
| -rw-r--r-- | src/service/formFactory.js | 24 | ||||
| -rw-r--r-- | src/service/log.js | 2 | ||||
| -rw-r--r-- | src/service/resource.js | 4 | ||||
| -rw-r--r-- | src/service/route.js | 2 | ||||
| -rw-r--r-- | src/service/routeParams.js | 2 | ||||
| -rw-r--r-- | src/service/xhr.bulk.js | 2 | ||||
| -rw-r--r-- | src/service/xhr.js | 2 | ||||
| -rw-r--r-- | src/widget/form.js | 6 | ||||
| -rw-r--r-- | src/widget/input.js | 24 | ||||
| -rw-r--r-- | src/widget/select.js | 36 | ||||
| -rw-r--r-- | src/widgets.js | 44 |
27 files changed, 175 insertions, 175 deletions
diff --git a/src/Angular.js b/src/Angular.js index 7c218c6e..9b651fce 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -14,7 +14,7 @@ if (typeof document.getAttribute == $undefined) * @param {string} string String to be converted to lowercase. * @returns {string} Lowercased string. */ -var lowercase = function (string){ return isString(string) ? string.toLowerCase() : string; }; +var lowercase = function(string){ return isString(string) ? string.toLowerCase() : string; }; /** @@ -26,17 +26,17 @@ var lowercase = function (string){ return isString(string) ? string.toLowerCase( * @param {string} string String to be converted to uppercase. * @returns {string} Uppercased string. */ -var uppercase = function (string){ return isString(string) ? string.toUpperCase() : string; }; +var uppercase = function(string){ return isString(string) ? string.toUpperCase() : string; }; -var manualLowercase = function (s) { +var manualLowercase = function(s) { return isString(s) - ? s.replace(/[A-Z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) | 32); }) + ? s.replace(/[A-Z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) | 32); }) : s; }; -var manualUppercase = function (s) { +var manualUppercase = function(s) { return isString(s) - ? s.replace(/[a-z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) & ~32); }) + ? s.replace(/[a-z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) & ~32); }) : s; }; @@ -239,7 +239,7 @@ function extend(dst) { function inherit(parent, extra) { - return extend(new (extend(function(){}, {prototype:parent}))(), extra); + return extend(new (extend(function() {}, {prototype:parent}))(), extra); } @@ -279,11 +279,11 @@ function noop() {} function identity($) {return $;} -function valueFn(value) {return function(){ return value; };} +function valueFn(value) {return function() { return value; };} function extensionMap(angular, name, transform) { var extPoint; - return angular[name] || (extPoint = angular[name] = function (name, fn, prop){ + return angular[name] || (extPoint = angular[name] = function(name, fn, prop){ name = (transform || identity)(name); if (isDefined(fn)) { extPoint[name] = extend(fn, prop || {}); @@ -604,12 +604,12 @@ function isLeafNode (node) { * <doc:example> * <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.master = { salutation: 'Hello', name: 'world' }; - this.copy = function (){ + this.copy = function() { this.form = angular.copy(this.master); } } @@ -709,7 +709,7 @@ function copy(source, destination){ * <doc:example> * <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.master = { salutation: 'Hello', name: 'world' @@ -969,7 +969,7 @@ function angularJsConfig(document) { return config; } -function bindJQuery(){ +function bindJQuery() { // bind to jQuery if present; jQuery = window.jQuery; // reset to jQuery or default to us. diff --git a/src/Browser.js b/src/Browser.js index 77d1c684..e45c7042 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -3,7 +3,7 @@ ////////////////////////////// // Browser ////////////////////////////// -var XHR = window.XMLHttpRequest || function () { +var XHR = window.XMLHttpRequest || function() { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {} @@ -56,7 +56,7 @@ function Browser(window, document, body, XHR, $log, $sniffer) { /** - * Executes the `fn` function (supports currying) and decrements the `outstandingRequestCallbacks` + * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks` * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed. */ function completeOutstandingRequest(fn) { @@ -322,7 +322,7 @@ function Browser(window, document, body, XHR, $log, $sniffer) { * * @returns {Object} Hash of all cookies (if called without any parameter) */ - self.cookies = function (name, value) { + self.cookies = function(name, value) { var cookieLength, cookieArray, cookie, i, keyValue, index; if (name) { diff --git a/src/Injector.js b/src/Injector.js index 0e0fddf6..d6cf15c2 100644 --- a/src/Injector.js +++ b/src/Injector.js @@ -44,7 +44,7 @@ function createInjector(factoryScope, factories, instanceCache) { factoryScope = factoryScope || {}; injector.invoke = invoke; - injector.eager = function(){ + injector.eager = function() { forEach(factories, function(factory, name){ if (factory.$eager) injector(name); diff --git a/src/Resource.js b/src/Resource.js index 045ab3a2..959561e4 100644 --- a/src/Resource.js +++ b/src/Resource.js @@ -67,7 +67,7 @@ ResourceFactory.prototype = { forEach(actions, function(action, name){ var isPostOrPut = action.method == 'POST' || action.method == 'PUT'; - Resource[name] = function (a1, a2, a3, a4) { + Resource[name] = function(a1, a2, a3, a4) { var params = {}; var data; var success = noop; diff --git a/src/Scope.js b/src/Scope.js index e4fc0622..be5030cc 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -50,7 +50,7 @@ function createScope(providers, instanceCache) { expect(scope.greeting).toEqual(undefined); - scope.$watch('name', function(){ + scope.$watch('name', function() { this.greeting = this.salutation + ' ' + this.name + '!'; }); // initialize the watch @@ -584,7 +584,7 @@ Scope.prototype = { event = { name: name, targetScope: scope, - cancel: function(){canceled = true;} + cancel: function() {canceled = true;} }, listenerArgs = concat([event], arguments, 1), i, length; diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 731c2c29..86f1b46f 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -146,7 +146,7 @@ function MockBrowser() { if (!expectation) { throw new Error("Unexpected request for method '" + method + "' and url '" + url + "'."); } - requests.push(function(){ + requests.push(function() { angular.forEach(expectation.headers, function(value, key){ if (headers[key] !== value) { throw new Error("Missing HTTP request header: " + key + ": " + value); @@ -317,7 +317,7 @@ MockBrowser.prototype = { * @description * run all fns in pollFns */ - poll: function poll(){ + poll: function poll() { angular.forEach(this.pollFns, function(pollFn){ pollFn(); }); @@ -356,10 +356,10 @@ MockBrowser.prototype = { } }, - addJs: function(){} + addJs: function() {} }; -angular.service('$browser', function(){ +angular.service('$browser', function() { return new MockBrowser(); }); @@ -397,10 +397,10 @@ angular.service('$log', MockLogFactory); function MockLogFactory() { var $log = { - log: function(){ $log.log.logs.push(arguments); }, - warn: function(){ $log.warn.logs.push(arguments); }, - info: function(){ $log.info.logs.push(arguments); }, - error: function(){ $log.error.logs.push(arguments); } + log: function() { $log.log.logs.push(arguments); }, + warn: function() { $log.warn.logs.push(arguments); }, + info: function() { $log.info.logs.push(arguments); }, + error: function() { $log.error.logs.push(arguments); } }; $log.log.logs = []; diff --git a/src/angular.suffix b/src/angular.suffix index 179e0ce6..e8bb83b7 100644 --- a/src/angular.suffix +++ b/src/angular.suffix @@ -1,5 +1,5 @@ - jqLiteWrap(document).ready(function(){ + jqLiteWrap(document).ready(function() { angularInit(angularJsConfig(document), document); }); diff --git a/src/apis.js b/src/apis.js index 6a5bf6c4..c9b2a99f 100644 --- a/src/apis.js +++ b/src/apis.js @@ -104,7 +104,7 @@ var angularArray = { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.books = ['Moby Dick', 'Great Gatsby', 'Romeo and Juliet']; this.bookName = 'Romeo and Juliet'; } @@ -154,7 +154,7 @@ var angularArray = { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.invoice = { items:[ { qty:10, @@ -400,7 +400,7 @@ var angularArray = { case "object": for (var key in expression) { if (key == '$') { - (function(){ + (function() { var text = (''+expression[key]).toLowerCase(); if (!text) return; predicates.push(function(value) { @@ -408,7 +408,7 @@ var angularArray = { }); })(); } else { - (function(){ + (function() { var path = key; var text = (''+expression[key]).toLowerCase(); if (!text) return; @@ -462,7 +462,7 @@ var angularArray = { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.people = []; } </script> @@ -612,7 +612,7 @@ var angularArray = { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.friends = [{name:'John', phone:'555-1212', age:10}, {name:'Mary', phone:'555-9876', age:19}, @@ -738,7 +738,7 @@ var angularArray = { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.numbers = [1,2,3,4,5,6,7,8,9]; this.limit = 3; } @@ -939,7 +939,7 @@ HashMap.prototype = { * A map where multiple values can be added to the same key such that the form a queue. * @returns {HashQueueMap} */ -function HashQueueMap(){} +function HashQueueMap() {} HashQueueMap.prototype = { /** * Same as array push, but using an array as the value for the hash diff --git a/src/directives.js b/src/directives.js index 852d04cd..b1502f54 100644 --- a/src/directives.js +++ b/src/directives.js @@ -61,7 +61,7 @@ </div> </doc:source> <doc:scenario> - it('should check greeting', function(){ + it('should check greeting', function() { expect(binding('greeting')).toBe('Hello'); expect(binding('person')).toBe('World'); }); @@ -115,10 +115,10 @@ angularDirective("ng:init", function(expression){ {type:'email', value:'john.smith@example.org'} ]; } SettingsController.prototype = { - greet: function(){ + greet: function() { alert(this.name); }, - addContact: function(){ + addContact: function() { this.contacts.push({type:'email', value:'yourname@example.org'}); }, removeContact: function(contactToRemove) { @@ -149,7 +149,7 @@ angularDirective("ng:init", function(expression){ </div> </doc:source> <doc:scenario> - it('should check controller', function(){ + it('should check controller', function() { expect(element('.doc-example-live div>:input').val()).toBe('John Smith'); expect(element('.doc-example-live li:nth-child(1) input').val()) .toBe('408 555 1212'); @@ -199,7 +199,7 @@ angularDirective("ng:controller", function(expression){ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.name = 'Whirled'; } </script> @@ -209,7 +209,7 @@ angularDirective("ng:controller", function(expression){ </div> </doc:source> <doc:scenario> - it('should check ng:bind', function(){ + it('should check ng:bind', function() { expect(using('.doc-example-live').binding('name')).toBe('Whirled'); using('.doc-example-live').input('name').enter('world'); expect(using('.doc-example-live').binding('name')).toBe('world'); @@ -326,7 +326,7 @@ function compileBindTemplate(template){ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.salutation = 'Hello'; this.name = 'World'; } @@ -338,7 +338,7 @@ function compileBindTemplate(template){ </div> </doc:source> <doc:scenario> - it('should check ng:bind', function(){ + it('should check ng:bind', function() { expect(using('.doc-example-live').binding('{{salutation}} {{name}}')). toBe('Hello World!'); using('.doc-example-live').input('salutation').enter('Greetings'); @@ -402,7 +402,7 @@ angularDirective("ng:bind-template", function(expression, element){ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.query = 'AngularJS'; } </script> @@ -413,7 +413,7 @@ angularDirective("ng:bind-template", function(expression, element){ </div> </doc:source> <doc:scenario> - it('should check ng:bind-attr', function(){ + it('should check ng:bind-attr', function() { expect(using('.doc-example-live').element('a').attr('href')). toBe('http://www.google.com/search?q=AngularJS'); using('.doc-example-live').input('query').enter('google'); @@ -471,7 +471,7 @@ angularDirective("ng:bind-attr", function(expression){ count: {{count}} </doc:source> <doc:scenario> - it('should check ng:click', function(){ + it('should check ng:click', function() { expect(binding('count')).toBe('0'); element('.doc-example-live :button').click(); expect(binding('count')).toBe('1'); @@ -516,10 +516,10 @@ angularDirective("ng:click", function(expression, element){ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.list = []; this.text = 'hello'; - this.submit = function(){ + this.submit = function() { this.list.push(this.text); this.text = ''; }; @@ -533,7 +533,7 @@ angularDirective("ng:click", function(expression, element){ </form> </doc:source> <doc:scenario> - it('should check ng:submit', function(){ + it('should check ng:submit', function() { expect(binding('list')).toBe('list=[]'); element('.doc-example-live #submit').click(); expect(binding('list')).toBe('list=["hello"]'); @@ -592,7 +592,7 @@ function ngClass(selector) { <span ng:class="myVar">Sample Text </span> </doc:source> <doc:scenario> - it('should check ng:class', function(){ + it('should check ng:class', function() { expect(element('.doc-example-live span').prop('className')).not(). toMatch(/ng-input-indicator-wait/); @@ -609,7 +609,7 @@ function ngClass(selector) { </doc:scenario> </doc:example> */ -angularDirective("ng:class", ngClass(function(){return true;})); +angularDirective("ng:class", ngClass(function() {return true;})); /** * @workInProgress @@ -641,7 +641,7 @@ angularDirective("ng:class", ngClass(function(){return true;})); </ol> </doc:source> <doc:scenario> - it('should check ng:class-odd and ng:class-even', function(){ + it('should check ng:class-odd and ng:class-even', function() { expect(element('.doc-example-live li:first span').prop('className')). toMatch(/ng-format-negative/); expect(element('.doc-example-live li:last span').prop('className')). @@ -682,7 +682,7 @@ angularDirective("ng:class-odd", ngClass(function(i){return i % 2 === 0;})); </ol> </doc:source> <doc:scenario> - it('should check ng:class-odd and ng:class-even', function(){ + it('should check ng:class-odd and ng:class-even', function() { expect(element('.doc-example-live li:first span').prop('className')). toMatch(/ng-format-negative/); expect(element('.doc-example-live li:last span').prop('className')). @@ -714,7 +714,7 @@ angularDirective("ng:class-even", ngClass(function(i){return i % 2 === 1;})); Hide: <span ng:hide="checked">I hide when your checkbox is checked.</span> </doc:source> <doc:scenario> - it('should check ng:show / ng:hide', function(){ + it('should check ng:show / ng:hide', function() { expect(element('.doc-example-live span:first:hidden').count()).toEqual(1); expect(element('.doc-example-live span:last:visible').count()).toEqual(1); @@ -755,7 +755,7 @@ angularDirective("ng:show", function(expression, element){ Hide: <span ng:hide="checked">I hide when you checkbox is checked?</span> </doc:source> <doc:scenario> - it('should check ng:show / ng:hide', function(){ + it('should check ng:show / ng:hide', function() { expect(element('.doc-example-live span:first:hidden').count()).toEqual(1); expect(element('.doc-example-live span:last:visible').count()).toEqual(1); @@ -798,7 +798,7 @@ angularDirective("ng:hide", function(expression, element){ <pre>myStyle={{myStyle}}</pre> </doc:source> <doc:scenario> - it('should check ng:style', function(){ + it('should check ng:style', function() { expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); element('.doc-example-live :button[value=set]').click(); expect(element('.doc-example-live span').css('color')).toBe('rgb(255, 0, 0)'); diff --git a/src/filters.js b/src/filters.js index 0fcd442b..e4ee7453 100644 --- a/src/filters.js +++ b/src/filters.js @@ -49,7 +49,7 @@ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.amount = 1234.56; } </script> @@ -60,11 +60,11 @@ </div> </doc:source> <doc:scenario> - it('should init with 1234.56', function(){ + it('should init with 1234.56', function() { expect(binding('amount | currency')).toBe('$1,234.56'); expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56'); }); - it('should update', function(){ + it('should update', function() { input('amount').enter('-1234'); expect(binding('amount | currency')).toBe('($1,234.00)'); expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)'); @@ -101,7 +101,7 @@ angularFilter.currency = function(amount, currencySymbol){ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.val = 1234.56789; } </script> @@ -113,13 +113,13 @@ angularFilter.currency = function(amount, currencySymbol){ </div> </doc:source> <doc:scenario> - it('should format numbers', function(){ + it('should format numbers', function() { expect(binding('val | number')).toBe('1,234.568'); expect(binding('val | number:0')).toBe('1,235'); expect(binding('-val | number:4')).toBe('-1,234.5679'); }); - it('should update', function(){ + it('should update', function() { input('val').enter('3374.333'); expect(binding('val | number')).toBe('3,374.333'); expect(binding('val | number:0')).toBe('3,374'); @@ -336,7 +336,7 @@ var GET_TIME_ZONE = /[A-Z]{3}(?![+\-])/, {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}<br/> </doc:source> <doc:scenario> - it('should format date', function(){ + it('should format date', function() { expect(binding("1288323623006 | date:'medium'")). toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")). @@ -477,7 +477,7 @@ angularFilter.uppercase = uppercase; <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.snippet = '<p style="color:blue">an html\n' + '<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' + @@ -515,7 +515,7 @@ angularFilter.uppercase = uppercase; </div> </doc:source> <doc:scenario> - it('should sanitize the html snippet ', function(){ + it('should sanitize the html snippet ', function() { expect(using('#html-filter').binding('snippet | html')). toBe('<p>an html\n<em>click here</em>\nsnippet</p>'); }); @@ -534,7 +534,7 @@ angularFilter.uppercase = uppercase; "snippet</p>"); }); - it('should update', function(){ + it('should update', function() { input('snippet').enter('new <b>text</b>'); expect(using('#html-filter').binding('snippet | html')).toBe('new <b>text</b>'); expect(using('#escaped-html').binding('snippet')).toBe("new <b>text</b>"); @@ -565,7 +565,7 @@ angularFilter.html = function(html, option){ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.snippet = 'Pretty text with some links:\n'+ 'http://angularjs.org/,\n'+ @@ -599,7 +599,7 @@ angularFilter.html = function(html, option){ </table> </doc:source> <doc:scenario> - it('should linkify the snippet with urls', function(){ + it('should linkify the snippet with urls', function() { expect(using('#linky-filter').binding('snippet | linky')). toBe('Pretty text with some links:\n' + '<a href="http://angularjs.org/">http://angularjs.org/</a>,\n' + @@ -617,7 +617,7 @@ angularFilter.html = function(html, option){ "and one more: ftp://127.0.0.1/."); }); - it('should update', function(){ + it('should update', function() { input('snippet').enter('new http://link.'); expect(using('#linky-filter').binding('snippet | linky')). toBe('new <a href="http://link">http://link</a>.'); diff --git a/src/jqLite.js b/src/jqLite.js index 0052055c..e14eb127 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -459,7 +459,7 @@ forEach({ if (!eventHandler) { bind[type] = eventHandler = function(event) { if (!event.preventDefault) { - event.preventDefault = function(){ + event.preventDefault = function() { event.returnValue = false; //ie }; } diff --git a/src/parser.js b/src/parser.js index 4934b9e6..ecdc25b9 100644 --- a/src/parser.js +++ b/src/parser.js @@ -142,7 +142,7 @@ function lex(text, parseStringsForObjects){ } number = 1 * number; tokens.push({index:start, text:number, json:true, - fn:function(){return number;}}); + fn:function() {return number;}}); } function readIdent() { var ident = ""; @@ -200,7 +200,7 @@ function lex(text, parseStringsForObjects){ } else if (ch == quote) { index++; tokens.push({index:start, text:rawString, string:string, json:true, - fn:function(){ + fn:function() { return (string.length == dateParseLength) ? angular['String']['toDate'](string) : string; @@ -239,7 +239,7 @@ function parser(text, json){ filterChain = functionIdent = pipeFunction = - function (){ throwError("is not valid json", {text:text, index:0}); }; + function() { throwError("is not valid json", {text:text, index:0}); }; } //TODO: Shouldn't all of the public methods have assertAllConsumed? //TODO: I think these should be public as part of the parser api instead of scope.$eval(). @@ -251,7 +251,7 @@ function parser(text, json){ }; function assertConsumed(fn) { - return function(){ + return function() { var value = fn(); if (tokens.length !== 0) { throwError("is an unexpected token", tokens[0]); @@ -320,7 +320,7 @@ function parser(text, json){ return tokens.length > 0; } - function statements(){ + function statements() { var statements = []; while(true) { if (tokens.length > 0 && !peek('}', ')', ';', ']')) @@ -330,7 +330,7 @@ function parser(text, json){ // TODO(size): maybe we should not support multiple statements? return statements.length == 1 ? statements[0] - : function (self){ + : function(self){ var value; for ( var i = 0; i < statements.length; i++) { var statement = statements[i]; @@ -343,7 +343,7 @@ function parser(text, json){ } } - function _filterChain(){ + function _filterChain() { var left = expression(); var token; while(true) { @@ -355,7 +355,7 @@ function parser(text, json){ } } - function filter(){ + function filter() { return pipeFunction(angularFilter); } @@ -374,18 +374,18 @@ function parser(text, json){ } return fn.apply(self, args); }; - return function(){ + return function() { return fnInvoke; }; } } } - function expression(){ + function expression() { return assignment(); } - function _assignment(){ + function _assignment() { var left = logicalOR(); var right; var token; @@ -403,7 +403,7 @@ function parser(text, json){ } } - function logicalOR(){ + function logicalOR() { var left = logicalAND(); var token; while(true) { @@ -415,7 +415,7 @@ function parser(text, json){ } } - function logicalAND(){ + function logicalAND() { var left = equality(); var token; if ((token = expect('&&'))) { @@ -424,7 +424,7 @@ function parser(text, json){ return left; } - function equality(){ + function equality() { var left = relational(); var token; if ((token = expect('==','!='))) { @@ -433,7 +433,7 @@ function parser(text, json){ return left; } - function relational(){ + function relational() { var left = additive(); var token; if ((token = expect('<', '>', '<=', '>='))) { @@ -442,7 +442,7 @@ function parser(text, json){ return left; } - function additive(){ + function additive() { var left = multiplicative(); var token; while ((token = expect('+','-'))) { @@ -451,7 +451,7 @@ function parser(text, json){ return left; } - function multiplicative(){ + function multiplicative() { var left = unary(); var token; while ((token = expect('*','/','%'))) { @@ -460,7 +460,7 @@ function parser(text, json){ return left; } - function unary(){ + function unary() { var token; if (expect('+')) { return primary(); @@ -524,7 +524,7 @@ function parser(text, json){ function _fieldAccess(object) { var field = expect().text; var getter = getterFn(field); - return extend(function (self){ + return extend(function(self){ return getter(object(self)); }, { assign:function(self, value){ @@ -537,7 +537,7 @@ function parser(text, json){ var indexFn = expression(); consume(']'); return extend( - function (self){ + function(self){ var o = obj(self); var i = indexFn(self); return (o) ? o[i] : undefined; @@ -556,7 +556,7 @@ function parser(text, json){ } while (expect(',')); } consume(')'); - return function (self){ + return function(self){ var args = []; for ( var i = 0; i < argsFn.length; i++) { args.push(argsFn[i](self)); @@ -578,7 +578,7 @@ function parser(text, json){ } while (expect(',')); } consume(']'); - return function (self){ + return function(self){ var array = []; for ( var i = 0; i < elementFns.length; i++) { array.push(elementFns[i](self)); @@ -599,7 +599,7 @@ function parser(text, json){ } while (expect(',')); } consume('}'); - return function (self){ + return function(self){ var object = {}; for ( var i = 0; i < keyValues.length; i++) { var keyValue = keyValues[i]; @@ -721,7 +721,7 @@ function getterFn(path) { }); code += 'return s;'; fn = Function('s', code); - fn["toString"] = function(){ return code; }; + fn["toString"] = function() { return code; }; return getterFnCache[path] = fn; } diff --git a/src/sanitizer.js b/src/sanitizer.js index da629c7a..eb8ed344 100644 --- a/src/sanitizer.js +++ b/src/sanitizer.js @@ -67,7 +67,7 @@ var validAttrs = extend({}, uriAttrs, makeMap( */ function htmlParser( html, handler ) { var index, chars, match, stack = [], last = html; - stack.last = function(){ return stack[ stack.length - 1 ]; }; + stack.last = function() { return stack[ stack.length - 1 ]; }; while ( html ) { chars = true; diff --git a/src/scenario/Scenario.js b/src/scenario/Scenario.js index 53be6c67..8d34bd0e 100644 --- a/src/scenario/Scenario.js +++ b/src/scenario/Scenario.js @@ -96,7 +96,7 @@ angular.scenario.matcher = angular.scenario.matcher || function(name, fn) { * * @param {Object=} config Config options */ -angular.scenario.setUpAndRun = function (config) { +angular.scenario.setUpAndRun = function(config) { var href = window.location.href; var body = _jQuery(document.body); var output = []; diff --git a/src/scenario/angular-bootstrap.js b/src/scenario/angular-bootstrap.js index 250d2845..35a98bda 100644 --- a/src/scenario/angular-bootstrap.js +++ b/src/scenario/angular-bootstrap.js @@ -1,7 +1,7 @@ 'use strict'; (function(previousOnLoad){ - var prefix = (function(){ + var prefix = (function() { var filename = /(.*\/)angular-bootstrap.js(#(.*))?/; var scripts = document.getElementsByTagName("script"); for(var j = 0; j < scripts.length; j++) { @@ -21,7 +21,7 @@ document.write('<link rel="stylesheet" type="text/css" href="' + prefix + path + '"/>'); } - window.onload = function(){ + window.onload = function() { try { if (previousOnLoad) previousOnLoad(); } catch(e) {} diff --git a/src/service/cookies.js b/src/service/cookies.js index 220a6ed5..c02fd8a8 100644 --- a/src/service/cookies.js +++ b/src/service/cookies.js @@ -45,7 +45,7 @@ angularServiceInject('$cookies', function($browser) { /** * Pushes all the cookies from the service to the browser and verifies if all cookies were stored. */ - function push(){ + function push() { var name, value, browserCookies, diff --git a/src/service/formFactory.js b/src/service/formFactory.js index 4fc53935..1efbe363 100644 --- a/src/service/formFactory.js +++ b/src/service/formFactory.js @@ -25,7 +25,7 @@ <doc:example> <doc:source> <script> - function EditorCntl(){ + function EditorCntl() { this.html = '<b>Hello</b> <i>World</i>!'; } @@ -33,7 +33,7 @@ var self = this; var htmlFilter = angular.filter('html'); - this.$parseModel = function(){ + this.$parseModel = function() { // need to protect for script injection try { this.$viewValue = htmlFilter(this.$modelValue || '').get(); @@ -47,18 +47,18 @@ } } - this.$render = function(){ + this.$render = function() { element.html(this.$viewValue); } - element.bind('keyup', function(){ - self.$apply(function(){ + element.bind('keyup', function() { + self.$apply(function() { self.$emit('$viewChange', element.html()); }); }); } - angular.directive('ng:contenteditable', function(){ + angular.directive('ng:contenteditable', function() { function linkFn($formFactory, element) { var exp = element.attr('ng:contenteditable'), form = $formFactory.forElement(element), @@ -70,7 +70,7 @@ controller: HTMLEditorWidget, controllerArgs: [element]}); // if the element is destroyed, then we need to notify the form. - element.bind('$destroy', function(){ + element.bind('$destroy', function() { widget.$destroy(); }); } @@ -88,7 +88,7 @@ </form> </doc:source> <doc:scenario> - it('should enter invalid HTML', function(){ + it('should enter invalid HTML', function() { expect(element('form[name=editorForm]').prop('className')).toMatch(/ng-valid/); input('html').enter('<'); expect(element('form[name=editorForm]').prop('className')).toMatch(/ng-invalid/); @@ -96,7 +96,7 @@ </doc:scenario> </doc:example> */ -angularServiceInject('$formFactory', function(){ +angularServiceInject('$formFactory', function() { /** @@ -123,7 +123,7 @@ angularServiceInject('$formFactory', function(){ * {@link angular.widget.form form} element. * @param {Element} element The element where the search for form should initiate. */ - formFactory.forElement = function (element) { + formFactory.forElement = function(element) { return element.inheritedData('$form') || formFactory.rootForm; }; return formFactory; @@ -225,7 +225,7 @@ function propertiesUpdate(widget) { * @param {*} viewValue The new value for the view which will be assigned to `widget.$viewValue`. */ -function FormController(){ +function FormController() { var form = this, $error = form.$error = {}; @@ -361,7 +361,7 @@ FormController.prototype.$createWidget = function(params) { // Set the state to something we know will change to get the process going. widget.$modelValue = Number.NaN; // watch for scope changes and update the view appropriately - modelScope.$watch(scopeGet, function (scope, value) { + modelScope.$watch(scopeGet, function(scope, value) { if (!equals(widget.$modelValue, value)) { widget.$modelValue = value; widget.$parseModel ? widget.$parseModel() : (widget.$viewValue = value); diff --git a/src/service/log.js b/src/service/log.js index 3dacd117..01254178 100644 --- a/src/service/log.js +++ b/src/service/log.js @@ -87,7 +87,7 @@ angularServiceInject("$log", $logFactory = function($window){ var console = $window.console || {}; var logFn = console[type] || console.log || noop; if (logFn.apply) { - return function(){ + return function() { var args = []; forEach(arguments, function(arg){ args.push(formatError(arg)); diff --git a/src/service/resource.js b/src/service/resource.js index 915f2d92..27bb1632 100644 --- a/src/service/resource.js +++ b/src/service/resource.js @@ -65,7 +65,7 @@ * update, delete) on server-side data like this: * <pre> var User = $resource('/user/:userId', {userId:'@id'}); - var user = User.get({userId:123}, function(){ + var user = User.get({userId:123}, function() { user.abc = true; user.$save(); }); @@ -136,7 +136,7 @@ <pre> var User = $resource('/user/:userId', {userId:'@id'}); - var user = User.get({userId:123}, function(){ + var user = User.get({userId:123}, function() { user.abc = true; user.$save(); }); diff --git a/src/service/route.js b/src/service/route.js index b78cca91..f5c8a672 100644 --- a/src/service/route.js +++ b/src/service/route.js @@ -188,7 +188,7 @@ angularServiceInject('$route', function($location, $routeParams) { * @description * Adds a new route definition to the `$route` service. */ - when: function (path, route) { + when: function(path, route) { var routeDef = routes[path]; if (!routeDef) routeDef = routes[path] = {reloadOnSearch: true}; if (route) extend(routeDef, route); // TODO(im): what the heck? merge two route definitions? diff --git a/src/service/routeParams.js b/src/service/routeParams.js index d9bfa61a..ac496ec7 100644 --- a/src/service/routeParams.js +++ b/src/service/routeParams.js @@ -26,6 +26,6 @@ * $routeParams ==> {chapterId:1, sectionId:2, search:'moby'} * </pre> */ -angularService('$routeParams', function(){ +angularService('$routeParams', function() { return {}; }); diff --git a/src/service/xhr.bulk.js b/src/service/xhr.bulk.js index 2365be77..db560556 100644 --- a/src/service/xhr.bulk.js +++ b/src/service/xhr.bulk.js @@ -83,6 +83,6 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){ } }); }; - this.$watch(function(){ bulkXHR.flush(); }); + this.$watch(function() { bulkXHR.flush(); }); return bulkXHR; }, ['$xhr', '$xhr.error', '$log']); diff --git a/src/service/xhr.js b/src/service/xhr.js index 4981c078..8a50964b 100644 --- a/src/service/xhr.js +++ b/src/service/xhr.js @@ -205,7 +205,7 @@ angularServiceInject('$xhr', function($browser, $error, $log){ response = fromJson(response, true); } } - rootScope.$apply(function(){ + rootScope.$apply(function() { if (200 <= code && code < 300) { success(code, response); } else if (isFunction(error)) { diff --git a/src/widget/form.js b/src/widget/form.js index bc34bf0d..b01a07ef 100644 --- a/src/widget/form.js +++ b/src/widget/form.js @@ -24,7 +24,7 @@ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.text = 'guest'; } </script> @@ -41,12 +41,12 @@ </div> </doc:source> <doc:scenario> - it('should initialize to model', function(){ + it('should initialize to model', function() { expect(binding('text')).toEqual('guest'); expect(binding('myForm.input.$valid')).toEqual('true'); }); - it('should be invalid if empty', function(){ + it('should be invalid if empty', function() { input('text').enter(''); expect(binding('text')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); diff --git a/src/widget/input.js b/src/widget/input.js index f82027f4..18d1ae12 100644 --- a/src/widget/input.js +++ b/src/widget/input.js @@ -25,7 +25,7 @@ var INTEGER_REGEXP = /^\s*(\-|\+)?\d+\s*$/; <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.text = 'guest'; this.word = /^\w*$/; } @@ -87,7 +87,7 @@ var INTEGER_REGEXP = /^\s*(\-|\+)?\d+\s*$/; <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.text = 'me@example.com'; } </script> @@ -155,7 +155,7 @@ angularInputType('email', function() { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.text = 'http://google.com'; } </script> @@ -222,7 +222,7 @@ angularInputType('url', function() { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.names = ['igor', 'misko', 'vojta']; } </script> @@ -295,7 +295,7 @@ angularInputType('list', function() { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.value = 12; } </script> @@ -359,7 +359,7 @@ angularInputType('number', numericRegexpInputType(NUMBER_REGEXP, 'NUMBER')); <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.value = 12; } </script> @@ -418,7 +418,7 @@ angularInputType('integer', numericRegexpInputType(INTEGER_REGEXP, 'INTEGER')); <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.value1 = true; this.value2 = 'YES' } @@ -446,7 +446,7 @@ angularInputType('integer', numericRegexpInputType(INTEGER_REGEXP, 'INTEGER')); </doc:scenario> </doc:example> */ -angularInputType('checkbox', function (inputElement) { +angularInputType('checkbox', function(inputElement) { var widget = this, trueValue = inputElement.attr('true-value'), falseValue = inputElement.attr('false-value'); @@ -490,7 +490,7 @@ angularInputType('checkbox', function (inputElement) { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.color = 'blue'; } </script> @@ -604,7 +604,7 @@ var HTML5_INPUTS_TYPES = makeMap( <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.text = 'guest'; } </script> @@ -635,7 +635,7 @@ var HTML5_INPUTS_TYPES = makeMap( </doc:scenario> </doc:example> */ -angularWidget('input', function (inputElement){ +angularWidget('input', function(inputElement){ this.directives(true); this.descend(true); var modelExp = inputElement.attr('ng:model'); @@ -715,7 +715,7 @@ angularWidget('input', function (inputElement){ } }); - forEach(['valid', 'invalid', 'pristine', 'dirty'], function (name) { + forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) { widget.$watch('$' + name, function(scope, value) { inputElement[value ? 'addClass' : 'removeClass']('ng-' + name); } diff --git a/src/widget/select.js b/src/widget/select.js index f397180e..1687721c 100644 --- a/src/widget/select.js +++ b/src/widget/select.js @@ -66,7 +66,7 @@ <doc:example> <doc:source> <script> - function MyCntrl(){ + function MyCntrl() { this.colors = [ {name:'black', shade:'dark'}, {name:'white', shade:'light'}, @@ -112,7 +112,7 @@ </div> </doc:source> <doc:scenario> - it('should check ng:options', function(){ + it('should check ng:options', function() { expect(binding('color')).toMatch('red'); select('color').option('0'); expect(binding('color')).toMatch('black'); @@ -128,7 +128,7 @@ var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/; -angularWidget('select', function (element){ +angularWidget('select', function(element){ this.directives(true); this.descend(true); return element.attr('ng:model') && annotate('$formFactory', function($formFactory, selectElement){ @@ -145,7 +145,7 @@ angularWidget('select', function (element){ alias: selectElement.attr('name'), controller: optionsExp ? Options : (multiple ? Multiple : Single)}); - selectElement.bind('$destroy', function(){ widget.$destroy(); }); + selectElement.bind('$destroy', function() { widget.$destroy(); }); widget.$pristine = !(widget.$dirty = false); @@ -153,7 +153,7 @@ angularWidget('select', function (element){ watchElementProperty(modelScope, widget, 'readonly', selectElement); watchElementProperty(modelScope, widget, 'disabled', selectElement); - widget.$on('$validate', function(){ + widget.$on('$validate', function() { var valid = !widget.$required || !!widget.$modelValue; if (valid && multiple && widget.$required) valid = !!widget.$modelValue.length; if (valid !== !widget.$error.REQUIRED) { @@ -161,11 +161,11 @@ angularWidget('select', function (element){ } }); - widget.$on('$viewChange', function(){ + widget.$on('$viewChange', function() { widget.$pristine = !(widget.$dirty = true); }); - forEach(['valid', 'invalid', 'pristine', 'dirty'], function (name) { + forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) { widget.$watch('$' + name, function(scope, value) { selectElement[value ? 'addClass' : 'removeClass']('ng-' + name); }); @@ -173,18 +173,18 @@ angularWidget('select', function (element){ //////////////////////////// - function Multiple(){ + function Multiple() { var widget = this; - this.$render = function(){ + this.$render = function() { var items = new HashMap(this.$viewValue); forEach(selectElement.children(), function(option){ option.selected = isDefined(items.get(option.value)); }); }; - selectElement.bind('change', function (){ - widget.$apply(function(){ + selectElement.bind('change', function() { + widget.$apply(function() { var array = []; forEach(selectElement.children(), function(option){ if (option.selected) { @@ -197,15 +197,15 @@ angularWidget('select', function (element){ } - function Single(){ + function Single() { var widget = this; - widget.$render = function(){ + widget.$render = function() { selectElement.val(widget.$viewValue); }; - selectElement.bind('change', function(){ - widget.$apply(function(){ + selectElement.bind('change', function() { + widget.$apply(function() { widget.$emit('$viewChange', selectElement.val()); }); }); @@ -213,7 +213,7 @@ angularWidget('select', function (element){ widget.$viewValue = selectElement.val(); } - function Options(){ + function Options() { var widget = this, match; @@ -249,8 +249,8 @@ angularWidget('select', function (element){ }); selectElement.html(''); // clear contents - selectElement.bind('change', function(){ - widgetScope.$apply(function(){ + selectElement.bind('change', function() { + widgetScope.$apply(function() { var optionGroup, collection = valuesFn(modelScope) || [], key = selectElement.val(), diff --git a/src/widgets.js b/src/widgets.js index e3c6906f..189dff29 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -49,7 +49,7 @@ <doc:example> <doc:source jsfiddle="false"> <script> - function Ctrl(){ + function Ctrl() { this.templates = [ { name: 'template1.html', url: 'examples/ng-include/template1.html'} , { name: 'template2.html', url: 'examples/ng-include/template2.html'} ]; @@ -66,16 +66,16 @@ </div> </doc:source> <doc:scenario> - it('should load template1.html', function(){ + it('should load template1.html', function() { expect(element('.doc-example-live .ng-include').text()). toBe('Content of template1.html\n'); }); - it('should load template2.html', function(){ + it('should load template2.html', function() { select('template').option('1'); expect(element('.doc-example-live .ng-include').text()). toBe('Content of template2.html\n'); }); - it('should change to blank', function(){ + it('should change to blank', function() { select('template').option(''); expect(element('.doc-example-live .ng-include').text()).toEqual(''); }); @@ -99,7 +99,7 @@ angularWidget('ng:include', function(element){ childScope, oldScope; - function incrementChange(){ changeCounter++;} + function incrementChange() { changeCounter++;} this.$watch(srcExp, incrementChange); this.$watch(function(scope){ var newScope = scope.$eval(scopeExp); @@ -108,7 +108,7 @@ angularWidget('ng:include', function(element){ incrementChange(); } }); - this.$watch(function(){return changeCounter;}, function(scope) { + this.$watch(function() {return changeCounter;}, function(scope) { var src = scope.$eval(srcExp), useScope = scope.$eval(scopeExp); @@ -161,7 +161,7 @@ angularWidget('ng:include', function(element){ <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.items = ['settings', 'home', 'other']; this.selection = this.items[0]; } @@ -179,21 +179,21 @@ angularWidget('ng:include', function(element){ </div> </doc:source> <doc:scenario> - it('should start in settings', function(){ + it('should start in settings', function() { expect(element('.doc-example-live ng\\:switch').text()).toEqual('Settings Div'); }); - it('should change to home', function(){ + it('should change to home', function() { select('selection').option('home'); expect(element('.doc-example-live ng\\:switch').text()).toEqual('Home Span'); }); - it('should select deafault', function(){ + it('should select deafault', function() { select('selection').option('other'); expect(element('.doc-example-live ng\\:switch').text()).toEqual('default'); }); </doc:scenario> </doc:example> */ -angularWidget('ng:switch', function (element) { +angularWidget('ng:switch', function(element) { var compiler = this, watchExpr = element.attr("on"), changeExpr = element.attr('change'), @@ -234,7 +234,7 @@ angularWidget('ng:switch', function (element) { } }); - this.$watch(function(){return changeCounter;}, function() { + this.$watch(function() {return changeCounter;}, function() { element.html(''); if (selectedTemplate) { selectedTemplate(childScope, function(caseElement) { @@ -325,7 +325,7 @@ angularWidget('a', function() { </div> </doc:source> <doc:scenario> - it('should check ng:repeat', function(){ + it('should check ng:repeat', function() { var r = using('.doc-example-live').repeater('ul li'); expect(r.count()).toBe(2); expect(r.row(0)).toEqual(["1","John","25"]); @@ -467,7 +467,7 @@ angularWidget('@ng:repeat', function(expression, element){ <div ng:non-bindable>Ignored: {{1 + 2}}</div> </doc:source> <doc:scenario> - it('should check ng:non-bindable', function(){ + it('should check ng:non-bindable', function() { expect(using('.doc-example-live').binding('1 + 2')).toBe('3'); expect(using('.doc-example-live').element('div:last').text()). toMatch(/1 \+ 2/); @@ -517,8 +517,8 @@ angularWidget("@ng:non-bindable", noop); }; MyCtrl.$inject = ['$route']; - function BootstrapCtrl(){} - function OverviewCtrl(){} + function BootstrapCtrl() {} + function OverviewCtrl() {} </script> <div ng:controller="MyCtrl"> <a href="overview">overview</a> | @@ -533,7 +533,7 @@ angularWidget("@ng:non-bindable", noop); </div> </doc:source> <doc:scenario> - it('should load templates', function(){ + it('should load templates', function() { element('.doc-example-live a:contains(overview)').click(); expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Overview/); @@ -552,11 +552,11 @@ angularWidget('ng:view', function(element) { var template; var changeCounter = 0; - this.$on('$afterRouteChange', function(){ + this.$on('$afterRouteChange', function() { changeCounter++; }); - this.$watch(function(){return changeCounter;}, function() { + this.$watch(function() {return changeCounter;}, function() { var template = $route.current && $route.current.template; if (template) { //xhr's callback must be async, see commit history for more info @@ -669,7 +669,7 @@ angularWidget('ng:view', function(element) { <doc:example> <doc:source> <script> - function Ctrl(){ + function Ctrl() { this.person1 = 'Igor'; this.person2 = 'Misko'; this.personCount = 1; @@ -700,7 +700,7 @@ angularWidget('ng:view', function(element) { </div> </doc:source> <doc:scenario> - it('should show correct pluralized string', function(){ + it('should show correct pluralized string', function() { expect(element('.doc-example-live .ng-pluralize:first').text()). toBe('1 person is viewing.'); expect(element('.doc-example-live .ng-pluralize:last').text()). @@ -731,7 +731,7 @@ angularWidget('ng:view', function(element) { toBe('Igor, Misko and 2 other people are viewing.'); }); - it('should show data-binded names', function(){ + it('should show data-binded names', function() { using('.doc-example-live').input('personCount').enter('4'); expect(element('.doc-example-live .ng-pluralize:last').text()). toBe('Igor, Misko and 2 other people are viewing.'); |
