diff options
| -rw-r--r-- | src/Angular.js | 76 | ||||
| -rw-r--r-- | src/AngularPublic.js | 2 | ||||
| -rw-r--r-- | src/angular-bootstrap.js | 3 | ||||
| -rw-r--r-- | src/jqLite.js | 20 | ||||
| -rw-r--r-- | src/ng/browser.js | 2 | ||||
| -rw-r--r-- | src/ng/compiler.js | 2 | ||||
| -rw-r--r-- | src/ng/directive/booleanAttrs.js | 4 | ||||
| -rw-r--r-- | src/ng/directive/directives.js | 2 | ||||
| -rw-r--r-- | src/ng/directive/form.js | 2 | ||||
| -rw-r--r-- | src/ng/directive/input.js | 6 | ||||
| -rw-r--r-- | src/ng/directive/ngInclude.js | 2 | ||||
| -rw-r--r-- | src/ng/directive/select.js | 2 | ||||
| -rw-r--r-- | src/ng/filter/filters.js | 4 | ||||
| -rw-r--r-- | src/ng/httpBackend.js | 4 | ||||
| -rw-r--r-- | src/ng/location.js | 2 | ||||
| -rw-r--r-- | src/ng/parse.js | 24 | ||||
| -rw-r--r-- | src/ng/rootScope.js | 2 | ||||
| -rw-r--r-- | src/ng/sanitize.js | 2 | ||||
| -rw-r--r-- | src/ngMock/angular-mocks.js | 9 | ||||
| -rw-r--r-- | src/ngScenario/ObjectModel.js | 2 | ||||
| -rw-r--r-- | src/ngScenario/Scenario.js | 4 | ||||
| -rw-r--r-- | src/ngScenario/dsl.js | 2 | ||||
| -rw-r--r-- | src/ngScenario/output/Html.js | 2 |
23 files changed, 50 insertions, 130 deletions
diff --git a/src/Angular.js b/src/Angular.js index beaf81d5..86a7fc1c 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -2,7 +2,7 @@ //////////////////////////////////// -if (typeof document.getAttribute == $undefined) +if (typeof document.getAttribute == 'undefined') document.getAttribute = function() {}; /** @@ -52,14 +52,7 @@ if ('i' !== 'I'.toLowerCase()) { function fromCharCode(code) {return String.fromCharCode(code);} -var $boolean = 'boolean', - $console = 'console', - $length = 'length', - $name = 'name', - $object = 'object', - $string = 'string', - $undefined = 'undefined', - Error = window.Error, +var Error = window.Error, /** holds major version number for IE or NaN for real browsers */ msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]), jqLite, // delay binding since jQuery could be loaded after us. @@ -107,7 +100,7 @@ function forEach(obj, iterator, context) { if (obj) { if (isFunction(obj)){ for (key in obj) { - if (key != 'prototype' && key != $length && key != $name && obj.hasOwnProperty(key)) { + if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) { iterator.call(context, obj[key], key); } } @@ -138,7 +131,7 @@ function sortedKeys(obj) { } function forEachSorted(obj, iterator, context) { - var keys = sortedKeys(obj) + var keys = sortedKeys(obj); for ( var i = 0; i < keys.length; i++) { iterator.call(context, obj[keys[i]], keys[i]); } @@ -269,7 +262,7 @@ function valueFn(value) {return function() {return value;};} * @param {*} value Reference to check. * @returns {boolean} True if `value` is undefined. */ -function isUndefined(value){return typeof value == $undefined;} +function isUndefined(value){return typeof value == 'undefined';} /** @@ -283,7 +276,7 @@ function isUndefined(value){return typeof value == $undefined;} * @param {*} value Reference to check. * @returns {boolean} True if `value` is defined. */ -function isDefined(value){return typeof value != $undefined;} +function isDefined(value){return typeof value != 'undefined';} /** @@ -298,7 +291,7 @@ function isDefined(value){return typeof value != $undefined;} * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Object` but not `null`. */ -function isObject(value){return value!=null && typeof value == $object;} +function isObject(value){return value != null && typeof value == 'object';} /** @@ -312,7 +305,7 @@ function isObject(value){return value!=null && typeof value == $object;} * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `String`. */ -function isString(value){return typeof value == $string;} +function isString(value){return typeof value == 'string';} /** @@ -397,8 +390,10 @@ function isFile(obj) { } -function isBoolean(value) {return typeof value == $boolean;} -function isTextNode(node) {return nodeName_(node) == '#text';} +function isBoolean(value) { + return typeof value == 'boolean'; +} + function trim(value) { return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; @@ -433,26 +428,6 @@ function makeMap(str){ } - -/** - * HTML class which is the only class which can be used in ngBind to inline HTML for security - * reasons. - * - * @constructor - * @param html raw (unsafe) html - * @param {string=} option If set to 'usafe', get method will return raw (unsafe/unsanitized) html - */ -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(''); - }; -} - if (msie < 9) { nodeName_ = function(element) { element = element.nodeName ? element : element[0]; @@ -465,12 +440,6 @@ if (msie < 9) { }; } -function isVisible(element) { - var rect = element[0].getBoundingClientRect(), - width = (rect.width || (rect.right||0 - rect.left||0)), - height = (rect.height || (rect.bottom||0 - rect.top||0)); - return width>0 && height>0; -} function map(obj, iterator, context) { var results = []; @@ -671,17 +640,6 @@ function equals(o1, o2) { return false; } -function setHtml(node, html) { - if (isLeafNode(node)) { - if (msie) { - node.innerText = html; - } else { - node.textContent = html; - } - } else { - node.innerHTML = html; - } -} function concat(array1, array2, index) { return array1.concat(slice.call(array2, index)); @@ -742,7 +700,7 @@ function toJsonReplacer(key, value) { } return val; -}; +} /** @@ -799,7 +757,7 @@ function startingTag(element) { // turns out IE does not let you set .html() on elements which // are not allowed to have children. So we just ignore it. element.html(''); - } catch(e) {}; + } catch(e) {} return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1]; } @@ -918,7 +876,7 @@ function angularInit(element, bootstrap) { forEach(element.querySelectorAll('.' + name), append); forEach(element.querySelectorAll('.' + name + '\\:'), append); forEach(element.querySelectorAll('[' + name + ']'), append); - }; + } }); forEach(elements, function(element) { @@ -1005,9 +963,7 @@ function bindJQuery() { */ function assertArg(arg, name, reason) { if (!arg) { - var error = new Error("Argument '" + (name||'?') + "' is " + - (reason || "required")); - throw error; + throw new Error("Argument '" + (name || '?') + "' is " + (reason || "required")); } return arg; } diff --git a/src/AngularPublic.js b/src/AngularPublic.js index 1326bf8c..352e14a8 100644 --- a/src/AngularPublic.js +++ b/src/AngularPublic.js @@ -130,4 +130,4 @@ function publishExternalAPI(angular){ }); } ]); -}; +} diff --git a/src/angular-bootstrap.js b/src/angular-bootstrap.js index 5b6e5937..716731a5 100644 --- a/src/angular-bootstrap.js +++ b/src/angular-bootstrap.js @@ -9,7 +9,6 @@ var filename = /^(.*\/)angular-bootstrap.js(#.*)?$/, scripts = document.getElementsByTagName("SCRIPT"), - config, serverPath, match, globalVars = {}; @@ -84,7 +83,7 @@ document.write('<script type="text/javascript" src="' + serverPath + file + '" ' + 'onload="angularClobberTest(\'' + file + '\')"></script>'); } - } + }; function addCss(file) { document.write('<link rel="stylesheet" type="text/css" href="' + diff --git a/src/jqLite.js b/src/jqLite.js index cb533a5e..0d00d091 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -87,24 +87,6 @@ var jqCache = {}, function jqNextId() { return (jqId++); } -function getStyle(element) { - var current = {}, style = element[0].style, value, name, i; - if (typeof style.length == 'number') { - for(i = 0; i < style.length; i++) { - name = style[i]; - current[name] = style[name]; - } - } else { - for (name in style) { - value = style[name]; - if (1*name != name && name != 'cssText' && value && typeof value == 'string' && value !='false') - current[name] = value; - } - } - return current; -} - - var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; var MOZ_HACK_REGEXP = /^moz([A-Z])/; @@ -546,7 +528,7 @@ function createEventHandler(element) { }; eventHandler.fns = []; return eventHandler; -}; +} ////////////////////////////////////////// // Functions iterating traversal. diff --git a/src/ng/browser.js b/src/ng/browser.js index 465114c5..fe14a3d7 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -249,7 +249,7 @@ function Browser(window, document, body, $log, $sniffer) { * @returns {Object} Hash of all cookies (if called without any parameter) */ self.cookies = function(name, value) { - var cookieLength, cookieArray, cookie, i, keyValue, index; + var cookieLength, cookieArray, cookie, i, index; if (name) { if (value === undefined) { diff --git a/src/ng/compiler.js b/src/ng/compiler.js index 912b068a..e4491723 100644 --- a/src/ng/compiler.js +++ b/src/ng/compiler.js @@ -446,7 +446,7 @@ function $CompileProvider($provide) { if (isBooleanAttr(node, nName)) { attrs[nName] = true; // presence means true } - addAttrInterpolateDirective(node, directives, value, nName) + addAttrInterpolateDirective(node, directives, value, nName); addDirective(directives, nName, 'A', maxPriority); } } diff --git a/src/ng/directive/booleanAttrs.js b/src/ng/directive/booleanAttrs.js index c9f286fb..e25b259c 100644 --- a/src/ng/directive/booleanAttrs.js +++ b/src/ng/directive/booleanAttrs.js @@ -282,7 +282,7 @@ forEach(BOOLEAN_ATTR, function(propName, attrName) { ngAttributeAliasDirectives[normalized] = function() { return { priority: 100, - compile: function(tpl, attr) { + compile: function() { return function(scope, element, attr) { attr.$$observers[attrName] = []; scope.$watch(attr[normalized], function(value) { @@ -301,7 +301,7 @@ forEach(['src', 'href'], function(attrName) { ngAttributeAliasDirectives[normalized] = function() { return { priority: 99, // it needs to run after the attributes are interpolated - compile: function(tpl, attr) { + compile: function() { return function(scope, element, attr) { var value = attr[normalized]; if (value == undefined) { diff --git a/src/ng/directive/directives.js b/src/ng/directive/directives.js index 123645f9..aa316533 100644 --- a/src/ng/directive/directives.js +++ b/src/ng/directive/directives.js @@ -8,4 +8,4 @@ function ngDirective(directive) { } directive.restrict = directive.restrict || 'AC'; return valueFn(directive); -}; +} diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js index ecb47ebe..5f1cc1d2 100644 --- a/src/ng/directive/form.js +++ b/src/ng/directive/form.js @@ -6,7 +6,7 @@ var nullFormCtrl = { $removeControl: noop, $setValidity: noop, $setDirty: noop -} +}; /** * @ngdoc object diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 6366f901..250a4520 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -477,7 +477,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { ctrl.$parsers.push(maxLengthValidator); ctrl.$formatters.push(maxLengthValidator); } -}; +} function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) { textInputType(scope, element, attr, ctrl, $sniffer, $browser); @@ -584,7 +584,7 @@ function radioInputType(scope, element, attr, ctrl) { scope.$apply(function() { ctrl.$setViewValue(attr.value); }); - }; + } }); ctrl.$render = function() { @@ -840,7 +840,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', 'ngModel', '$e this.$invalid = false; } } else { - toggleValidCss(false) + toggleValidCss(false); this.$invalid = true; this.$valid = false; invalidCount++; diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js index 13a090a4..9796b4e1 100644 --- a/src/ng/directive/ngInclude.js +++ b/src/ng/directive/ngInclude.js @@ -82,7 +82,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' onloadExp = attr.onload || '', autoScrollExp = attr.autoscroll; - return function(scope, element, attr) { + return function(scope, element) { var changeCounter = 0, childScope; diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index 384b312e..49137b33 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -421,7 +421,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) { while(optionGroupsCache.length > groupIndex) { optionGroupsCache.pop()[0].element.remove(); } - }; + } } } } diff --git a/src/ng/filter/filters.js b/src/ng/filter/filters.js index f5e96bbf..faea82d4 100644 --- a/src/ng/filter/filters.js +++ b/src/ng/filter/filters.js @@ -344,7 +344,7 @@ function dateFilter($locale) { parts = [], fn, match; - format = format || 'mediumDate' + format = format || 'mediumDate'; format = $locale.DATETIME_FORMATS[format] || format; if (isString(date)) { if (NUMBER_STRING.test(date)) { @@ -545,4 +545,4 @@ function linkyFilter() { writer.chars(raw); return html.join(''); }; -}; +} diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index d2784efa..fd825577 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -108,7 +108,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, doneWrapper = function() { rawDocument.body.removeChild(script); if (done) done(); - } + }; script.type = 'text/javascript'; script.src = url; @@ -122,5 +122,5 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, } rawDocument.body.appendChild(script); - }; + } } diff --git a/src/ng/location.js b/src/ng/location.js index b0270432..6bed261f 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -449,7 +449,7 @@ function $LocationProvider(){ } else { return hashPrefix; } - } + }; /** * @ngdoc property diff --git a/src/ng/parse.js b/src/ng/parse.js index cd60bc83..e5cb55d7 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -161,7 +161,7 @@ function lex(text){ //check if this is not a method invocation and if it is back out to last dot if (lastDot) { - peekIndex = index + peekIndex = index; while(peekIndex < text.length) { var ch = text.charAt(peekIndex); if (ch == '(') { @@ -269,7 +269,8 @@ function parser(text, json, $filter){ functionCall = _functionCall, fieldAccess = _fieldAccess, objectIndex = _objectIndex, - filterChain = _filterChain + filterChain = _filterChain; + if(json){ // The extra level of aliasing is here, just in case the lexer misses something, so that // we prevent any accidental execution in JSON. @@ -344,10 +345,6 @@ function parser(text, json, $filter){ }; } - function hasTokens () { - return tokens.length > 0; - } - function statements() { var statements = []; while(true) { @@ -497,21 +494,6 @@ function parser(text, json, $filter){ } } - function _functionIdent(fnScope) { - var token = expect(); - var element = token.text.split('.'); - var instance = fnScope; - var key; - for ( var i = 0; i < element.length; i++) { - key = element[i]; - if (instance) - instance = instance[key]; - } - if (!isFunction(instance)) { - throwError("should be a function", token); - } - return instance; - } function primary() { var primary; diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 08f8a428..2541ec24 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -66,7 +66,7 @@ function $RootScopeProvider(){ TTL = value; } return TTL; - } + }; this.$get = ['$injector', '$exceptionHandler', '$parse', function( $injector, $exceptionHandler, $parse) { diff --git a/src/ng/sanitize.js b/src/ng/sanitize.js index 7ca0711a..6a7a2be4 100644 --- a/src/ng/sanitize.js +++ b/src/ng/sanitize.js @@ -110,7 +110,7 @@ function $SanitizeProvider() { htmlParser(html, htmlSanitizeWriter(buf)); return buf.join(''); }); -}; +} // Regular Expressions for parsing tags and attributes var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index 42d921e3..4478f389 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -241,13 +241,15 @@ angular.mock.$ExceptionHandlerProvider = function() { break; case 'log': var errors = []; + handler = function(e) { if (arguments.length == 1) { errors.push(e); } else { errors.push([].slice.call(arguments, 0)); } - } + }; + handler.errors = errors; break; default: @@ -445,7 +447,7 @@ angular.mock.$LogProvider = function() { if (angular.isString(timestamp)) { var tsStr = timestamp; - self.origDate = jsonStringToDate(timestamp) + self.origDate = jsonStringToDate(timestamp); timestamp = self.origDate.getTime(); if (isNaN(timestamp)) @@ -1224,7 +1226,7 @@ function createHttpBackendMock($delegate, $browser) { } }); } -}; +} function MockHttpExpectation(method, url, data, headers) { @@ -1544,7 +1546,6 @@ window.jasmine && (function(window) { */ window.module = angular.mock.module = function() { var moduleFns = Array.prototype.slice.call(arguments, 0); - var stack = new Error('Module Declaration Location:').stack; return isSpecRunning() ? workFn() : workFn; ///////////////////// function workFn() { diff --git a/src/ngScenario/ObjectModel.js b/src/ngScenario/ObjectModel.js index b4dad1a5..609652f4 100644 --- a/src/ngScenario/ObjectModel.js +++ b/src/ngScenario/ObjectModel.js @@ -73,7 +73,7 @@ angular.scenario.ObjectModel = function(runner) { self.emit('StepBegin', it, step); }); - runner.on('StepEnd', function(spec, step) { + runner.on('StepEnd', function(spec) { var it = self.getSpec(spec.id); var step = it.getLastStep(); if (step.name !== step.name) diff --git a/src/ngScenario/Scenario.js b/src/ngScenario/Scenario.js index 7335d5de..19da6444 100644 --- a/src/ngScenario/Scenario.js +++ b/src/ngScenario/Scenario.js @@ -176,7 +176,7 @@ function asyncForEach(list, iterator, done) { * to a specific line length. * * @param {Object} error The exception to format, can be anything throwable - * @param {Number} maxStackLines Optional. max lines of the stack trace to include + * @param {Number=} [maxStackLines=5] max lines of the stack trace to include * default is 5. */ function formatException(error, maxStackLines) { @@ -307,7 +307,7 @@ function browserTrigger(element, type, keys) { pressed('shift'), pressed('meta'), 0, element); element.dispatchEvent(evnt); - finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault) + finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault); delete appWindow.angular['ff-684208-preventDefault']; diff --git a/src/ngScenario/dsl.js b/src/ngScenario/dsl.js index 7f399394..7ca33a26 100644 --- a/src/ngScenario/dsl.js +++ b/src/ngScenario/dsl.js @@ -128,7 +128,7 @@ angular.scenario.dsl('browser', function() { return api; }; - return function(time) { + return function() { return chain; }; }); diff --git a/src/ngScenario/output/Html.js b/src/ngScenario/output/Html.js index 326928d8..7f69a734 100644 --- a/src/ngScenario/output/Html.js +++ b/src/ngScenario/output/Html.js @@ -24,7 +24,7 @@ angular.scenario.output('html', function(context, runner, model) { '</div>' ); - runner.on('InteractivePause', function(spec, step) { + runner.on('InteractivePause', function(spec) { var ui = lastStepUiMap[spec.id]; ui.find('.test-title'). html('paused... <a href="javascript:resume()">resume</a> when ready.'); |
