@@ -51,7 +51,7 @@ import {
51
51
RippleRef ,
52
52
RippleState ,
53
53
} from '@angular/material/core' ;
54
- import { SpecificEventListener , EventType } from '@material/base' ;
54
+ import { SpecificEventListener , EventType } from '@material/base/types ' ;
55
55
import { MDCSliderAdapter , MDCSliderFoundation , Thumb , TickMark } from '@material/slider' ;
56
56
import { Subscription } from 'rxjs' ;
57
57
import { GlobalChangeAndInputListener } from './global-change-and-input-listener' ;
@@ -977,7 +977,15 @@ class SliderAdapter implements MDCSliderAdapter {
977
977
return this . _delegate . _getInputElement ( thumbPosition ) . getAttribute ( attribute ) ;
978
978
}
979
979
setInputAttribute = ( attribute : string , value : string , thumbPosition : Thumb ) : void => {
980
- this . _delegate . _getInputElement ( thumbPosition ) . setAttribute ( attribute , value ) ;
980
+ const input = this . _delegate . _getInputElement ( thumbPosition ) ;
981
+
982
+ // Explicitly check the attribute we are setting to prevent xss.
983
+ if ( attribute === 'aria-valuetext' ) { input . setAttribute ( 'aria-valuetext' , value ) ; }
984
+ else if ( attribute === 'disabled' ) { input . setAttribute ( 'disabled' , value ) ; }
985
+ else if ( attribute === 'min' ) { input . setAttribute ( 'min' , value ) ; }
986
+ else if ( attribute === 'max' ) { input . setAttribute ( 'max' , value ) ; }
987
+ else if ( attribute === 'value' ) { input . setAttribute ( 'value' , value ) ; }
988
+ else if ( attribute === 'step' ) { input . setAttribute ( 'step' , value ) ; }
981
989
}
982
990
removeInputAttribute = ( attribute : string , thumbPosition : Thumb ) : void => {
983
991
this . _delegate . _getInputElement ( thumbPosition ) . removeAttribute ( attribute ) ;
0 commit comments