@@ -2,7 +2,7 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core';
22import  {  Component ,  Element ,  Event ,  Host ,  Prop ,  State ,  Watch ,  h  }  from  '@stencil/core' ; 
33import  {  findClosestIonContent ,  disableContentScrollY ,  resetContentScrollY  }  from  '@utils/content' ; 
44import  type  {  Attributes  }  from  '@utils/helpers' ; 
5- import  {  inheritAriaAttributes ,  clamp ,  debounceEvent ,  renderHiddenInput  }  from  '@utils/helpers' ; 
5+ import  {  inheritAriaAttributes ,  clamp ,  debounceEvent ,  renderHiddenInput ,   isSafeNumber  }  from  '@utils/helpers' ; 
66import  {  printIonWarning  }  from  '@utils/logging' ; 
77import  {  isRTL  }  from  '@utils/rtl' ; 
88import  {  createColorClasses ,  hostContext  }  from  '@utils/theme' ; 
@@ -109,7 +109,11 @@ export class Range implements ComponentInterface {
109109   */ 
110110  @Prop ( )  min  =  0 ; 
111111  @Watch ( 'min' ) 
112-   protected  minChanged ( )  { 
112+   protected  minChanged ( newValue : number )  { 
113+     if  ( ! isSafeNumber ( newValue ) )  { 
114+       this . min  =  0 ; 
115+     } 
116+ 
113117    if  ( ! this . noUpdate )  { 
114118      this . updateRatio ( ) ; 
115119    } 
@@ -120,7 +124,11 @@ export class Range implements ComponentInterface {
120124   */ 
121125  @Prop ( )  max  =  100 ; 
122126  @Watch ( 'max' ) 
123-   protected  maxChanged ( )  { 
127+   protected  maxChanged ( newValue : number )  { 
128+     if  ( ! isSafeNumber ( newValue ) )  { 
129+       this . max  =  100 ; 
130+     } 
131+ 
124132    if  ( ! this . noUpdate )  { 
125133      this . updateRatio ( ) ; 
126134    } 
@@ -300,6 +308,10 @@ export class Range implements ComponentInterface {
300308    } 
301309
302310    this . inheritedAttributes  =  inheritAriaAttributes ( this . el ) ; 
311+     // If the min or max is not safe, set it to 0 or 100 respectively. 
312+     // Our watch does this, but not before the initial load. 
313+     this . min  =  isSafeNumber ( this . min )  ? this . min  : 0 ; 
314+     this . max  =  isSafeNumber ( this . max )  ? this . max  : 100 ; 
303315  } 
304316
305317  componentDidLoad ( )  { 
0 commit comments