@@ -1529,7 +1529,7 @@ function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1529
1529
}
1530
1530
1531
1531
// TODO(matsko): implement validateLater to reduce number of validations
1532
- if ( minAttrType === 'min' ) {
1532
+ if ( supportsRange && minAttrType === 'min' ) {
1533
1533
var elVal = element . val ( ) ;
1534
1534
// IE11 doesn't set the el val correctly if the maxVal is less than the element value
1535
1535
if ( minVal > elVal ) {
@@ -1543,9 +1543,11 @@ function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1543
1543
1544
1544
var minAttrType = isDefined ( attr . min ) ? 'min' : attr . ngMin ? 'ngMin' : false ;
1545
1545
if ( minAttrType ) {
1546
- ctrl . $validators . min = isDefined ( attr . min ) && supportsRange && isDefined ( validity . rangeUnderflow ) ?
1547
- function nativeMinValidator ( value ) {
1548
- return ! element [ 0 ] . validity . rangeUnderflow ;
1546
+ // Since ngMin doesn't set the min attr, the browser doesn't adjust the input value as setting min would
1547
+ ctrl . $validators . min = isDefined ( attr . min ) && supportsRange ?
1548
+ function noopMinValidator ( value ) {
1549
+ // Since all browsers set the input to a valid value, we don't need to check validity
1550
+ return true ;
1549
1551
} :
1550
1552
function minValidator ( modelValue , viewValue ) {
1551
1553
return ctrl . $isEmpty ( viewValue ) || isUndefined ( minVal ) || viewValue >= minVal ;
@@ -1567,7 +1569,7 @@ function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1567
1569
return ;
1568
1570
}
1569
1571
1570
- if ( maxAttrType === 'max' ) {
1572
+ if ( supportsRange && maxAttrType === 'max' ) {
1571
1573
var elVal = element . val ( ) ;
1572
1574
// IE11 doesn't set the el val correctly if the maxVal is less than the element value
1573
1575
if ( maxVal < elVal ) {
@@ -1581,10 +1583,10 @@ function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
1581
1583
var maxAttrType = isDefined ( attr . max ) ? 'max' : attr . ngMax ? 'ngMax' : false ;
1582
1584
if ( maxAttrType ) {
1583
1585
// Since ngMax doesn't set the max attr, the browser doesn't adjust the input value as setting max would
1584
- ctrl . $validators . max = isDefined ( attr . max ) && supportsRange && isDefined ( validity . rangeOverflow ) ?
1585
- function nativeMaxValidator ( ) {
1586
- // IE10+11 incorrectly set the rangeOverflow error when max < min
1587
- return ( msie > 9 && maxVal < minVal ) ? true : ! element [ 0 ] . validity . rangeOverflow ;
1586
+ ctrl . $validators . max = isDefined ( attr . max ) && supportsRange ?
1587
+ function noopMaxValidator ( ) {
1588
+ // Since all browsers set the input to a valid value, we don't need to check validity
1589
+ return true ;
1588
1590
} :
1589
1591
function maxValidator ( modelValue , viewValue ) {
1590
1592
return ctrl . $isEmpty ( viewValue ) || isUndefined ( maxVal ) || viewValue <= maxVal ;
0 commit comments