|
171 | 171 | if (!equals(o1[key], o2[key])) return !1;
|
172 | 172 | keySet[key] = !0;
|
173 | 173 | }
|
174 |
| - for(key in o2)if (!keySet.hasOwnProperty(key) && "$" !== key.charAt(0) && undefined !== o2[key] && !isFunction(o2[key])) return !1; |
| 174 | + for(key in o2)if (!keySet.hasOwnProperty(key) && "$" !== key.charAt(0) && o2[key] !== undefined && !isFunction(o2[key])) return !1; |
175 | 175 | return !0;
|
176 | 176 | }
|
177 | 177 | }
|
|
199 | 199 | return "string" == typeof key && "$" === key.charAt(0) ? val = undefined : isWindow(value) ? val = "$WINDOW" : value && document1 === value ? val = "$DOCUMENT" : isScope(value) && (val = "$SCOPE"), val;
|
200 | 200 | }
|
201 | 201 | function toJson(obj, pretty) {
|
202 |
| - if (void 0 !== obj) return JSON.stringify(obj, toJsonReplacer, pretty ? " " : null); |
| 202 | + return void 0 === obj ? undefined : JSON.stringify(obj, toJsonReplacer, pretty ? " " : null); |
203 | 203 | }
|
204 | 204 | function fromJson(json) {
|
205 | 205 | return isString(json) ? JSON.parse(json) : json;
|
|
440 | 440 | for(var names = isArray(name) ? name : [
|
441 | 441 | name
|
442 | 442 | ]; element.length;){
|
443 |
| - for(var i = 0, ii = names.length; i < ii; i++)if (undefined !== (value = element.data(names[i]))) return value; |
| 443 | + for(var i = 0, ii = names.length; i < ii; i++)if ((value = element.data(names[i])) !== undefined) return value; |
444 | 444 | element = element.parent();
|
445 | 445 | }
|
446 | 446 | }
|
|
939 | 939 | var cookieLength, cookieArray, cookie, i, index;
|
940 | 940 | if (name) undefined === value ? rawDocument.cookie = escape(name) + "=;path=" + cookiePath + ";expires=Thu, 01 Jan 1970 00:00:00 GMT" : isString(value) && (cookieLength = (rawDocument.cookie = escape(name) + "=" + escape(value) + ";path=" + cookiePath).length + 1) > 4096 && $log.warn("Cookie '" + name + "' possibly not set or overflowed because it was too large (" + cookieLength + " > 4096 bytes)!");
|
941 | 941 | else {
|
942 |
| - if (rawDocument.cookie !== lastCookieString) for(i = 0, cookieArray = (lastCookieString = rawDocument.cookie).split("; "), lastCookies = {}; i < cookieArray.length; i++)(index = (cookie = cookieArray[i]).indexOf("=")) > 0 && undefined === lastCookies[name = unescape(cookie.substring(0, index))] && (lastCookies[name] = unescape(cookie.substring(index + 1))); |
| 942 | + if (rawDocument.cookie !== lastCookieString) for(i = 0, cookieArray = (lastCookieString = rawDocument.cookie).split("; "), lastCookies = {}; i < cookieArray.length; i++)(index = (cookie = cookieArray[i]).indexOf("=")) > 0 && lastCookies[name = unescape(cookie.substring(0, index))] === undefined && (lastCookies[name] = unescape(cookie.substring(index + 1))); |
943 | 943 | return lastCookies;
|
944 | 944 | }
|
945 | 945 | }, self.defer = function(fn, delay) {
|
|
1847 | 1847 | this.$$url = encodePath(this.$$path) + (search ? "?" + search : "") + hash, this.$$absUrl = appBaseNoFile + this.$$url.substr(1);
|
1848 | 1848 | }, this.$$rewrite = function(url) {
|
1849 | 1849 | var appUrl, prevAppUrl;
|
1850 |
| - return undefined !== (appUrl = beginsWith(appBase, url)) ? (prevAppUrl = appUrl, undefined !== (appUrl = beginsWith(basePrefix, appUrl))) ? appBaseNoFile + (beginsWith("/", appUrl) || appUrl) : appBase + prevAppUrl : undefined !== (appUrl = beginsWith(appBaseNoFile, url)) ? appBaseNoFile + appUrl : appBaseNoFile == url + "/" ? appBaseNoFile : void 0; |
| 1850 | + return (appUrl = beginsWith(appBase, url)) !== undefined ? (prevAppUrl = appUrl, (appUrl = beginsWith(basePrefix, appUrl)) !== undefined) ? appBaseNoFile + (beginsWith("/", appUrl) || appUrl) : appBase + prevAppUrl : (appUrl = beginsWith(appBaseNoFile, url)) !== undefined ? appBaseNoFile + appUrl : appBaseNoFile == url + "/" ? appBaseNoFile : void 0; |
1851 | 1851 | };
|
1852 | 1852 | }
|
1853 | 1853 | function LocationHashbangUrl(appBase, hashPrefix) {
|
|
2246 | 2246 | promise.then(function(val) {
|
2247 | 2247 | promise.$$v = val;
|
2248 | 2248 | });
|
2249 |
| - }(obj), undefined === obj.$$v && (obj.$$v = {}), obj = obj.$$v); |
| 2249 | + }(obj), obj.$$v === undefined && (obj.$$v = {}), obj = obj.$$v); |
2250 | 2250 | }
|
2251 | 2251 | return obj[key = ensureSafeMemberName(element.shift(), fullExp)] = setValue, setValue;
|
2252 | 2252 | }
|
|
2403 | 2403 | var parser = this, indexFn = this.expression();
|
2404 | 2404 | return this.consume("]"), extend(function(self, locals) {
|
2405 | 2405 | var v, p, o = obj(self, locals), i = indexFn(self, locals);
|
2406 |
| - if (o) return (v = ensureSafeObject(o[i], parser.text)) && v.then && parser.options.unwrapPromises && (p = v, "$$v" in v || (p.$$v = undefined, p.then(function(val) { |
| 2406 | + return o ? ((v = ensureSafeObject(o[i], parser.text)) && v.then && parser.options.unwrapPromises && (p = v, "$$v" in v || (p.$$v = undefined, p.then(function(val) { |
2407 | 2407 | p.$$v = val;
|
2408 |
| - })), v = v.$$v), v; |
| 2408 | + })), v = v.$$v), v) : undefined; |
2409 | 2409 | }, {
|
2410 | 2410 | assign: function(self, value, locals) {
|
2411 | 2411 | var key = indexFn(self, locals);
|
|
3488 | 3488 | number: function(scope, element, attr, ctrl, $sniffer, $browser) {
|
3489 | 3489 | if (textInputType(scope, element, attr, ctrl, $sniffer, $browser), ctrl.$parsers.push(function(value) {
|
3490 | 3490 | var empty = ctrl.$isEmpty(value);
|
3491 |
| - if (empty || NUMBER_REGEXP.test(value)) return ctrl.$setValidity("number", !0), "" === value ? null : empty ? value : parseFloat(value); |
3492 |
| - ctrl.$setValidity("number", !1); |
| 3491 | + return empty || NUMBER_REGEXP.test(value) ? (ctrl.$setValidity("number", !0), "" === value ? null : empty ? value : parseFloat(value)) : (ctrl.$setValidity("number", !1), undefined); |
3493 | 3492 | }), ctrl.$formatters.push(function(value) {
|
3494 | 3493 | return ctrl.$isEmpty(value) ? "" : "" + value;
|
3495 | 3494 | }), attr.min) {
|
3496 | 3495 | var minValidator = function(value) {
|
3497 | 3496 | var min = parseFloat(attr.min);
|
3498 |
| - if (ctrl.$isEmpty(value) || !(value < min)) return ctrl.$setValidity("min", !0), value; |
3499 |
| - ctrl.$setValidity("min", !1); |
| 3497 | + return !ctrl.$isEmpty(value) && value < min ? (ctrl.$setValidity("min", !1), undefined) : (ctrl.$setValidity("min", !0), value); |
3500 | 3498 | };
|
3501 | 3499 | ctrl.$parsers.push(minValidator), ctrl.$formatters.push(minValidator);
|
3502 | 3500 | }
|
3503 | 3501 | if (attr.max) {
|
3504 | 3502 | var maxValidator = function(value) {
|
3505 | 3503 | var max = parseFloat(attr.max);
|
3506 |
| - if (ctrl.$isEmpty(value) || !(value > max)) return ctrl.$setValidity("max", !0), value; |
3507 |
| - ctrl.$setValidity("max", !1); |
| 3504 | + return !ctrl.$isEmpty(value) && value > max ? (ctrl.$setValidity("max", !1), undefined) : (ctrl.$setValidity("max", !0), value); |
3508 | 3505 | };
|
3509 | 3506 | ctrl.$parsers.push(maxValidator), ctrl.$formatters.push(maxValidator);
|
3510 | 3507 | }
|
3511 | 3508 | ctrl.$formatters.push(function(value) {
|
3512 |
| - if (ctrl.$isEmpty(value) || isNumber(value)) return ctrl.$setValidity("number", !0), value; |
3513 |
| - ctrl.$setValidity("number", !1); |
| 3509 | + return ctrl.$isEmpty(value) || isNumber(value) ? (ctrl.$setValidity("number", !0), value) : (ctrl.$setValidity("number", !1), undefined); |
3514 | 3510 | });
|
3515 | 3511 | },
|
3516 | 3512 | url: function(scope, element, attr, ctrl, $sniffer, $browser) {
|
3517 | 3513 | textInputType(scope, element, attr, ctrl, $sniffer, $browser);
|
3518 | 3514 | var urlValidator = function(value) {
|
3519 |
| - if (ctrl.$isEmpty(value) || URL_REGEXP.test(value)) return ctrl.$setValidity("url", !0), value; |
3520 |
| - ctrl.$setValidity("url", !1); |
| 3515 | + return ctrl.$isEmpty(value) || URL_REGEXP.test(value) ? (ctrl.$setValidity("url", !0), value) : (ctrl.$setValidity("url", !1), undefined); |
3521 | 3516 | };
|
3522 | 3517 | ctrl.$formatters.push(urlValidator), ctrl.$parsers.push(urlValidator);
|
3523 | 3518 | },
|
3524 | 3519 | email: function(scope, element, attr, ctrl, $sniffer, $browser) {
|
3525 | 3520 | textInputType(scope, element, attr, ctrl, $sniffer, $browser);
|
3526 | 3521 | var emailValidator = function(value) {
|
3527 |
| - if (ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value)) return ctrl.$setValidity("email", !0), value; |
3528 |
| - ctrl.$setValidity("email", !1); |
| 3522 | + return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value) ? (ctrl.$setValidity("email", !0), value) : (ctrl.$setValidity("email", !1), undefined); |
3529 | 3523 | };
|
3530 | 3524 | ctrl.$formatters.push(emailValidator), ctrl.$parsers.push(emailValidator);
|
3531 | 3525 | },
|
|
3591 | 3585 | element.val(ctrl.$isEmpty(ctrl.$viewValue) ? "" : ctrl.$viewValue);
|
3592 | 3586 | };
|
3593 | 3587 | var patternValidator, match, pattern = attr.ngPattern, validate = function(regexp, value) {
|
3594 |
| - if (ctrl.$isEmpty(value) || regexp.test(value)) return ctrl.$setValidity("pattern", !0), value; |
3595 |
| - ctrl.$setValidity("pattern", !1); |
| 3588 | + return ctrl.$isEmpty(value) || regexp.test(value) ? (ctrl.$setValidity("pattern", !0), value) : (ctrl.$setValidity("pattern", !1), undefined); |
3596 | 3589 | };
|
3597 | 3590 | if (pattern && ((match = pattern.match(/^\/(.*)\/([gim]*)$/)) ? (pattern = new RegExp(match[1], match[2]), patternValidator = function(value) {
|
3598 | 3591 | return validate(pattern, value);
|
|
3602 | 3595 | return validate(patternObj, value);
|
3603 | 3596 | }, ctrl.$formatters.push(patternValidator), ctrl.$parsers.push(patternValidator)), attr.ngMinlength) {
|
3604 | 3597 | var minlength = int(attr.ngMinlength), minLengthValidator = function(value) {
|
3605 |
| - if (ctrl.$isEmpty(value) || !(value.length < minlength)) return ctrl.$setValidity("minlength", !0), value; |
3606 |
| - ctrl.$setValidity("minlength", !1); |
| 3598 | + return !ctrl.$isEmpty(value) && value.length < minlength ? (ctrl.$setValidity("minlength", !1), undefined) : (ctrl.$setValidity("minlength", !0), value); |
3607 | 3599 | };
|
3608 | 3600 | ctrl.$parsers.push(minLengthValidator), ctrl.$formatters.push(minLengthValidator);
|
3609 | 3601 | }
|
3610 | 3602 | if (attr.ngMaxlength) {
|
3611 | 3603 | var maxlength = int(attr.ngMaxlength), maxLengthValidator = function(value) {
|
3612 |
| - if (ctrl.$isEmpty(value) || !(value.length > maxlength)) return ctrl.$setValidity("maxlength", !0), value; |
3613 |
| - ctrl.$setValidity("maxlength", !1); |
| 3604 | + return !ctrl.$isEmpty(value) && value.length > maxlength ? (ctrl.$setValidity("maxlength", !1), undefined) : (ctrl.$setValidity("maxlength", !0), value); |
3614 | 3605 | };
|
3615 | 3606 | ctrl.$parsers.push(maxLengthValidator), ctrl.$formatters.push(maxLengthValidator);
|
3616 | 3607 | }
|
|
3720 | 3711 | }), list;
|
3721 | 3712 | }
|
3722 | 3713 | }), ctrl.$formatters.push(function(value) {
|
3723 |
| - if (isArray(value)) return value.join(", "); |
| 3714 | + return isArray(value) ? value.join(", ") : undefined; |
3724 | 3715 | }), ctrl.$isEmpty = function(value) {
|
3725 | 3716 | return !value || !value.length;
|
3726 | 3717 | };
|
|
0 commit comments