mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-18 11:31:07 +00:00
chore(*): remove dead code and fix code style issues
This commit is contained in:
parent
fcc556df37
commit
52ee1ab5eb
23 changed files with 50 additions and 130 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
|
|
||||||
if (typeof document.getAttribute == $undefined)
|
if (typeof document.getAttribute == 'undefined')
|
||||||
document.getAttribute = function() {};
|
document.getAttribute = function() {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -52,14 +52,7 @@ if ('i' !== 'I'.toLowerCase()) {
|
||||||
function fromCharCode(code) {return String.fromCharCode(code);}
|
function fromCharCode(code) {return String.fromCharCode(code);}
|
||||||
|
|
||||||
|
|
||||||
var $boolean = 'boolean',
|
var Error = window.Error,
|
||||||
$console = 'console',
|
|
||||||
$length = 'length',
|
|
||||||
$name = 'name',
|
|
||||||
$object = 'object',
|
|
||||||
$string = 'string',
|
|
||||||
$undefined = 'undefined',
|
|
||||||
Error = window.Error,
|
|
||||||
/** holds major version number for IE or NaN for real browsers */
|
/** holds major version number for IE or NaN for real browsers */
|
||||||
msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
|
msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
|
||||||
jqLite, // delay binding since jQuery could be loaded after us.
|
jqLite, // delay binding since jQuery could be loaded after us.
|
||||||
|
|
@ -107,7 +100,7 @@ function forEach(obj, iterator, context) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
if (isFunction(obj)){
|
if (isFunction(obj)){
|
||||||
for (key in 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);
|
iterator.call(context, obj[key], key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +131,7 @@ function sortedKeys(obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function forEachSorted(obj, iterator, context) {
|
function forEachSorted(obj, iterator, context) {
|
||||||
var keys = sortedKeys(obj)
|
var keys = sortedKeys(obj);
|
||||||
for ( var i = 0; i < keys.length; i++) {
|
for ( var i = 0; i < keys.length; i++) {
|
||||||
iterator.call(context, obj[keys[i]], keys[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.
|
* @param {*} value Reference to check.
|
||||||
* @returns {boolean} True if `value` is undefined.
|
* @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.
|
* @param {*} value Reference to check.
|
||||||
* @returns {boolean} True if `value` is defined.
|
* @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.
|
* @param {*} value Reference to check.
|
||||||
* @returns {boolean} True if `value` is an `Object` but not `null`.
|
* @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.
|
* @param {*} value Reference to check.
|
||||||
* @returns {boolean} True if `value` is a `String`.
|
* @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 isBoolean(value) {
|
||||||
function isTextNode(node) {return nodeName_(node) == '#text';}
|
return typeof value == 'boolean';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function trim(value) {
|
function trim(value) {
|
||||||
return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : 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) {
|
if (msie < 9) {
|
||||||
nodeName_ = function(element) {
|
nodeName_ = function(element) {
|
||||||
element = element.nodeName ? element : element[0];
|
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) {
|
function map(obj, iterator, context) {
|
||||||
var results = [];
|
var results = [];
|
||||||
|
|
@ -671,17 +640,6 @@ function equals(o1, o2) {
|
||||||
return false;
|
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) {
|
function concat(array1, array2, index) {
|
||||||
return array1.concat(slice.call(array2, index));
|
return array1.concat(slice.call(array2, index));
|
||||||
|
|
@ -742,7 +700,7 @@ function toJsonReplacer(key, value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -799,7 +757,7 @@ function startingTag(element) {
|
||||||
// turns out IE does not let you set .html() on elements which
|
// turns out IE does not let you set .html() on elements which
|
||||||
// are not allowed to have children. So we just ignore it.
|
// are not allowed to have children. So we just ignore it.
|
||||||
element.html('');
|
element.html('');
|
||||||
} catch(e) {};
|
} catch(e) {}
|
||||||
return jqLite('<div>').append(element).html().match(/^(<[^>]+>)/)[1];
|
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(element.querySelectorAll('.' + name + '\\:'), append);
|
||||||
forEach(element.querySelectorAll('[' + name + ']'), append);
|
forEach(element.querySelectorAll('[' + name + ']'), append);
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
forEach(elements, function(element) {
|
forEach(elements, function(element) {
|
||||||
|
|
@ -1005,9 +963,7 @@ function bindJQuery() {
|
||||||
*/
|
*/
|
||||||
function assertArg(arg, name, reason) {
|
function assertArg(arg, name, reason) {
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
var error = new Error("Argument '" + (name||'?') + "' is " +
|
throw new Error("Argument '" + (name || '?') + "' is " + (reason || "required"));
|
||||||
(reason || "required"));
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,4 +130,4 @@ function publishExternalAPI(angular){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
};
|
}
|
||||||
|
|
|
||||||
3
src/angular-bootstrap.js
vendored
3
src/angular-bootstrap.js
vendored
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
var filename = /^(.*\/)angular-bootstrap.js(#.*)?$/,
|
var filename = /^(.*\/)angular-bootstrap.js(#.*)?$/,
|
||||||
scripts = document.getElementsByTagName("SCRIPT"),
|
scripts = document.getElementsByTagName("SCRIPT"),
|
||||||
config,
|
|
||||||
serverPath,
|
serverPath,
|
||||||
match,
|
match,
|
||||||
globalVars = {};
|
globalVars = {};
|
||||||
|
|
@ -84,7 +83,7 @@
|
||||||
document.write('<script type="text/javascript" src="' + serverPath + file + '" ' +
|
document.write('<script type="text/javascript" src="' + serverPath + file + '" ' +
|
||||||
'onload="angularClobberTest(\'' + file + '\')"></script>');
|
'onload="angularClobberTest(\'' + file + '\')"></script>');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function addCss(file) {
|
function addCss(file) {
|
||||||
document.write('<link rel="stylesheet" type="text/css" href="' +
|
document.write('<link rel="stylesheet" type="text/css" href="' +
|
||||||
|
|
|
||||||
|
|
@ -87,24 +87,6 @@ var jqCache = {},
|
||||||
function jqNextId() { return (jqId++); }
|
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 SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
|
||||||
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
||||||
|
|
||||||
|
|
@ -546,7 +528,7 @@ function createEventHandler(element) {
|
||||||
};
|
};
|
||||||
eventHandler.fns = [];
|
eventHandler.fns = [];
|
||||||
return eventHandler;
|
return eventHandler;
|
||||||
};
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
// Functions iterating traversal.
|
// Functions iterating traversal.
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ function Browser(window, document, body, $log, $sniffer) {
|
||||||
* @returns {Object} Hash of all cookies (if called without any parameter)
|
* @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;
|
var cookieLength, cookieArray, cookie, i, index;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,7 @@ function $CompileProvider($provide) {
|
||||||
if (isBooleanAttr(node, nName)) {
|
if (isBooleanAttr(node, nName)) {
|
||||||
attrs[nName] = true; // presence means true
|
attrs[nName] = true; // presence means true
|
||||||
}
|
}
|
||||||
addAttrInterpolateDirective(node, directives, value, nName)
|
addAttrInterpolateDirective(node, directives, value, nName);
|
||||||
addDirective(directives, nName, 'A', maxPriority);
|
addDirective(directives, nName, 'A', maxPriority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ forEach(BOOLEAN_ATTR, function(propName, attrName) {
|
||||||
ngAttributeAliasDirectives[normalized] = function() {
|
ngAttributeAliasDirectives[normalized] = function() {
|
||||||
return {
|
return {
|
||||||
priority: 100,
|
priority: 100,
|
||||||
compile: function(tpl, attr) {
|
compile: function() {
|
||||||
return function(scope, element, attr) {
|
return function(scope, element, attr) {
|
||||||
attr.$$observers[attrName] = [];
|
attr.$$observers[attrName] = [];
|
||||||
scope.$watch(attr[normalized], function(value) {
|
scope.$watch(attr[normalized], function(value) {
|
||||||
|
|
@ -301,7 +301,7 @@ forEach(['src', 'href'], function(attrName) {
|
||||||
ngAttributeAliasDirectives[normalized] = function() {
|
ngAttributeAliasDirectives[normalized] = function() {
|
||||||
return {
|
return {
|
||||||
priority: 99, // it needs to run after the attributes are interpolated
|
priority: 99, // it needs to run after the attributes are interpolated
|
||||||
compile: function(tpl, attr) {
|
compile: function() {
|
||||||
return function(scope, element, attr) {
|
return function(scope, element, attr) {
|
||||||
var value = attr[normalized];
|
var value = attr[normalized];
|
||||||
if (value == undefined) {
|
if (value == undefined) {
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,4 @@ function ngDirective(directive) {
|
||||||
}
|
}
|
||||||
directive.restrict = directive.restrict || 'AC';
|
directive.restrict = directive.restrict || 'AC';
|
||||||
return valueFn(directive);
|
return valueFn(directive);
|
||||||
};
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ var nullFormCtrl = {
|
||||||
$removeControl: noop,
|
$removeControl: noop,
|
||||||
$setValidity: noop,
|
$setValidity: noop,
|
||||||
$setDirty: noop
|
$setDirty: noop
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc object
|
* @ngdoc object
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
|
||||||
ctrl.$parsers.push(maxLengthValidator);
|
ctrl.$parsers.push(maxLengthValidator);
|
||||||
ctrl.$formatters.push(maxLengthValidator);
|
ctrl.$formatters.push(maxLengthValidator);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
|
function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
|
||||||
textInputType(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() {
|
scope.$apply(function() {
|
||||||
ctrl.$setViewValue(attr.value);
|
ctrl.$setViewValue(attr.value);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ctrl.$render = function() {
|
ctrl.$render = function() {
|
||||||
|
|
@ -840,7 +840,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', 'ngModel', '$e
|
||||||
this.$invalid = false;
|
this.$invalid = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toggleValidCss(false)
|
toggleValidCss(false);
|
||||||
this.$invalid = true;
|
this.$invalid = true;
|
||||||
this.$valid = false;
|
this.$valid = false;
|
||||||
invalidCount++;
|
invalidCount++;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
||||||
onloadExp = attr.onload || '',
|
onloadExp = attr.onload || '',
|
||||||
autoScrollExp = attr.autoscroll;
|
autoScrollExp = attr.autoscroll;
|
||||||
|
|
||||||
return function(scope, element, attr) {
|
return function(scope, element) {
|
||||||
var changeCounter = 0,
|
var changeCounter = 0,
|
||||||
childScope;
|
childScope;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
|
||||||
while(optionGroupsCache.length > groupIndex) {
|
while(optionGroupsCache.length > groupIndex) {
|
||||||
optionGroupsCache.pop()[0].element.remove();
|
optionGroupsCache.pop()[0].element.remove();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ function dateFilter($locale) {
|
||||||
parts = [],
|
parts = [],
|
||||||
fn, match;
|
fn, match;
|
||||||
|
|
||||||
format = format || 'mediumDate'
|
format = format || 'mediumDate';
|
||||||
format = $locale.DATETIME_FORMATS[format] || format;
|
format = $locale.DATETIME_FORMATS[format] || format;
|
||||||
if (isString(date)) {
|
if (isString(date)) {
|
||||||
if (NUMBER_STRING.test(date)) {
|
if (NUMBER_STRING.test(date)) {
|
||||||
|
|
@ -545,4 +545,4 @@ function linkyFilter() {
|
||||||
writer.chars(raw);
|
writer.chars(raw);
|
||||||
return html.join('');
|
return html.join('');
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
|
||||||
doneWrapper = function() {
|
doneWrapper = function() {
|
||||||
rawDocument.body.removeChild(script);
|
rawDocument.body.removeChild(script);
|
||||||
if (done) done();
|
if (done) done();
|
||||||
}
|
};
|
||||||
|
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
script.src = url;
|
script.src = url;
|
||||||
|
|
@ -122,5 +122,5 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
rawDocument.body.appendChild(script);
|
rawDocument.body.appendChild(script);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ function $LocationProvider(){
|
||||||
} else {
|
} else {
|
||||||
return hashPrefix;
|
return hashPrefix;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc property
|
* @ngdoc property
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ function lex(text){
|
||||||
|
|
||||||
//check if this is not a method invocation and if it is back out to last dot
|
//check if this is not a method invocation and if it is back out to last dot
|
||||||
if (lastDot) {
|
if (lastDot) {
|
||||||
peekIndex = index
|
peekIndex = index;
|
||||||
while(peekIndex < text.length) {
|
while(peekIndex < text.length) {
|
||||||
var ch = text.charAt(peekIndex);
|
var ch = text.charAt(peekIndex);
|
||||||
if (ch == '(') {
|
if (ch == '(') {
|
||||||
|
|
@ -269,7 +269,8 @@ function parser(text, json, $filter){
|
||||||
functionCall = _functionCall,
|
functionCall = _functionCall,
|
||||||
fieldAccess = _fieldAccess,
|
fieldAccess = _fieldAccess,
|
||||||
objectIndex = _objectIndex,
|
objectIndex = _objectIndex,
|
||||||
filterChain = _filterChain
|
filterChain = _filterChain;
|
||||||
|
|
||||||
if(json){
|
if(json){
|
||||||
// The extra level of aliasing is here, just in case the lexer misses something, so that
|
// The extra level of aliasing is here, just in case the lexer misses something, so that
|
||||||
// we prevent any accidental execution in JSON.
|
// we prevent any accidental execution in JSON.
|
||||||
|
|
@ -344,10 +345,6 @@ function parser(text, json, $filter){
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasTokens () {
|
|
||||||
return tokens.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function statements() {
|
function statements() {
|
||||||
var statements = [];
|
var statements = [];
|
||||||
while(true) {
|
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() {
|
function primary() {
|
||||||
var primary;
|
var primary;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ function $RootScopeProvider(){
|
||||||
TTL = value;
|
TTL = value;
|
||||||
}
|
}
|
||||||
return TTL;
|
return TTL;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.$get = ['$injector', '$exceptionHandler', '$parse',
|
this.$get = ['$injector', '$exceptionHandler', '$parse',
|
||||||
function( $injector, $exceptionHandler, $parse) {
|
function( $injector, $exceptionHandler, $parse) {
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ function $SanitizeProvider() {
|
||||||
htmlParser(html, htmlSanitizeWriter(buf));
|
htmlParser(html, htmlSanitizeWriter(buf));
|
||||||
return buf.join('');
|
return buf.join('');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
// Regular Expressions for parsing tags and attributes
|
// Regular Expressions for parsing tags and attributes
|
||||||
var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,
|
var START_TAG_REGEXP = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,
|
||||||
|
|
|
||||||
9
src/ngMock/angular-mocks.js
vendored
9
src/ngMock/angular-mocks.js
vendored
|
|
@ -241,13 +241,15 @@ angular.mock.$ExceptionHandlerProvider = function() {
|
||||||
break;
|
break;
|
||||||
case 'log':
|
case 'log':
|
||||||
var errors = [];
|
var errors = [];
|
||||||
|
|
||||||
handler = function(e) {
|
handler = function(e) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
errors.push(e);
|
errors.push(e);
|
||||||
} else {
|
} else {
|
||||||
errors.push([].slice.call(arguments, 0));
|
errors.push([].slice.call(arguments, 0));
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
handler.errors = errors;
|
handler.errors = errors;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -445,7 +447,7 @@ angular.mock.$LogProvider = function() {
|
||||||
if (angular.isString(timestamp)) {
|
if (angular.isString(timestamp)) {
|
||||||
var tsStr = timestamp;
|
var tsStr = timestamp;
|
||||||
|
|
||||||
self.origDate = jsonStringToDate(timestamp)
|
self.origDate = jsonStringToDate(timestamp);
|
||||||
|
|
||||||
timestamp = self.origDate.getTime();
|
timestamp = self.origDate.getTime();
|
||||||
if (isNaN(timestamp))
|
if (isNaN(timestamp))
|
||||||
|
|
@ -1224,7 +1226,7 @@ function createHttpBackendMock($delegate, $browser) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function MockHttpExpectation(method, url, data, headers) {
|
function MockHttpExpectation(method, url, data, headers) {
|
||||||
|
|
||||||
|
|
@ -1544,7 +1546,6 @@ window.jasmine && (function(window) {
|
||||||
*/
|
*/
|
||||||
window.module = angular.mock.module = function() {
|
window.module = angular.mock.module = function() {
|
||||||
var moduleFns = Array.prototype.slice.call(arguments, 0);
|
var moduleFns = Array.prototype.slice.call(arguments, 0);
|
||||||
var stack = new Error('Module Declaration Location:').stack;
|
|
||||||
return isSpecRunning() ? workFn() : workFn;
|
return isSpecRunning() ? workFn() : workFn;
|
||||||
/////////////////////
|
/////////////////////
|
||||||
function workFn() {
|
function workFn() {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ angular.scenario.ObjectModel = function(runner) {
|
||||||
self.emit('StepBegin', it, step);
|
self.emit('StepBegin', it, step);
|
||||||
});
|
});
|
||||||
|
|
||||||
runner.on('StepEnd', function(spec, step) {
|
runner.on('StepEnd', function(spec) {
|
||||||
var it = self.getSpec(spec.id);
|
var it = self.getSpec(spec.id);
|
||||||
var step = it.getLastStep();
|
var step = it.getLastStep();
|
||||||
if (step.name !== step.name)
|
if (step.name !== step.name)
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ function asyncForEach(list, iterator, done) {
|
||||||
* to a specific line length.
|
* to a specific line length.
|
||||||
*
|
*
|
||||||
* @param {Object} error The exception to format, can be anything throwable
|
* @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.
|
* default is 5.
|
||||||
*/
|
*/
|
||||||
function formatException(error, maxStackLines) {
|
function formatException(error, maxStackLines) {
|
||||||
|
|
@ -307,7 +307,7 @@ function browserTrigger(element, type, keys) {
|
||||||
pressed('shift'), pressed('meta'), 0, element);
|
pressed('shift'), pressed('meta'), 0, element);
|
||||||
|
|
||||||
element.dispatchEvent(evnt);
|
element.dispatchEvent(evnt);
|
||||||
finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault)
|
finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault);
|
||||||
|
|
||||||
delete appWindow.angular['ff-684208-preventDefault'];
|
delete appWindow.angular['ff-684208-preventDefault'];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ angular.scenario.dsl('browser', function() {
|
||||||
return api;
|
return api;
|
||||||
};
|
};
|
||||||
|
|
||||||
return function(time) {
|
return function() {
|
||||||
return chain;
|
return chain;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ angular.scenario.output('html', function(context, runner, model) {
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
runner.on('InteractivePause', function(spec, step) {
|
runner.on('InteractivePause', function(spec) {
|
||||||
var ui = lastStepUiMap[spec.id];
|
var ui = lastStepUiMap[spec.id];
|
||||||
ui.find('.test-title').
|
ui.find('.test-title').
|
||||||
html('paused... <a href="javascript:resume()">resume</a> when ready.');
|
html('paused... <a href="javascript:resume()">resume</a> when ready.');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue