Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3e1442a

Browse files
committed
fixup! perf(input): prevent multiple validations on compilation
1 parent 0b5af26 commit 3e1442a

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/ng/directive/input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,7 @@ function numberInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter
17731773

17741774
attr.$observe('step', function(val) {
17751775
// TODO(matsko): implement validateLater to reduce number of validations
1776-
if (stepVal !== val) {
1776+
if (val !== stepVal) {
17771777
parsedStepVal = parseNumberAttrVal(val);
17781778
stepVal = val;
17791779
ctrl.$validate();

src/ng/directive/ngRepeat.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict';
1+
'use strict';
22

33
/* exported ngRepeatDirective */
44

@@ -531,8 +531,6 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
531531

532532
//watch props
533533
$scope.$watchCollection(rhs, function ngRepeatAction(collection) {
534-
// console.log('ngRepeat action')
535-
536534
var index, length,
537535
previousNode = $element[0], // node that cloned nodes should be inserted after
538536
// initialized to the comment node anchor

src/ng/directive/validators.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ var patternDirective = function($parse) {
178178
if (tAttr.ngPattern) {
179179
patternExp = tAttr.ngPattern;
180180

181-
// ngPattern might be a scope expressions, or an inlined regex, which is not parsable.
181+
// ngPattern might be a scope expression, or an inlined regex, which is not parsable.
182182
// We get value of the attribute here, so we can compare the old and the new value
183183
// in the observer to avoid unnecessary validations
184184
try {
@@ -395,11 +395,11 @@ var minlengthDirective = function($parse) {
395395
if (!ctrl) return;
396396

397397
var minlength = attr.minlength || $parse(attr.ngMinlength)(scope);
398-
var minlengthParsed = toInt(minlength) || 0;
398+
var minlengthParsed = parseLength(minlength) || -1;
399399

400400
attr.$observe('minlength', function(value) {
401401
if (minlength !== value) {
402-
minlengthParsed = toInt(value) || 0;
402+
minlengthParsed = parseLength(value) || -1;
403403
minlength = value;
404404
ctrl.$validate();
405405
}
@@ -416,7 +416,7 @@ var minlengthDirective = function($parse) {
416416
function parsePatternAttr(regex, patternExp, elm) {
417417
if (!regex) return undefined;
418418

419-
if (isString(regex) && regex.length > 0) {
419+
if (isString(regex)) {
420420
regex = new RegExp('^' + regex + '$');
421421
}
422422

0 commit comments

Comments
 (0)