@@ -1599,11 +1599,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1599
1599
* @name $compileProvider#addPropertyContext
1600
1600
* @description
1601
1601
*
1602
- * Defines the security context for HTML properties bound by ng-prop-*
1602
+ * Defines the security context for DOM properties bound by ng-prop-*
1603
1603
*
1604
- * @param {string } elementName the element name or '*' to match any element
1605
- * @param {string } propertyName the property name
1606
- * @param {string } ctx the context type
1604
+ * @param {string } elementName The element name or '*' to match any element.
1605
+ * @param {string } propertyName The DOM property name.
1606
+ * @param {string } ctx The context in which this value is safe for use, e.g. $sce.URL,
1607
+ * $sce.RESOURCE_URL, $sce.HTML, $sce.JS or $sce.CSS.
1607
1608
*/
1608
1609
this . addPropertyContext = function ( elementName , propertyName , ctx ) {
1609
1610
var key = ( elementName . toLowerCase ( ) + '|' + propertyName . toLowerCase ( ) ) ;
@@ -1644,16 +1645,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1644
1645
'form|action' ,
1645
1646
'input|src' ,
1646
1647
'ins|cite' ,
1647
- 'q|cite' ,
1648
- 'script|src' ,
1649
- 'video|poster'
1648
+ 'q|cite'
1650
1649
] ) ;
1651
1650
registerContext ( SCE_CONTEXTS . MEDIA_URL , [
1652
1651
'audio|src' ,
1653
1652
'img|src' , 'img|srcset' ,
1654
1653
'source|src' , 'source|srcset' ,
1655
1654
'track|src' ,
1656
- 'video|src'
1655
+ 'video|src' , 'video|poster'
1657
1656
] ) ;
1658
1657
registerContext ( SCE_CONTEXTS . RESOURCE_URL , [
1659
1658
'applet|code' , 'applet|codebase' ,
@@ -1721,7 +1720,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1721
1720
return value ;
1722
1721
}
1723
1722
if ( ! isString ( value ) ) {
1724
- throw $compileMinErr ( 'srcset' , 'Can\'t pass trusted values to `' + invokeType + ' `: "{0 }"', value . toString ( ) ) ;
1723
+ throw $compileMinErr ( 'srcset' , 'Can\'t pass trusted values to `{0} `: "{1 }"' , invokeType , value . toString ( ) ) ;
1725
1724
}
1726
1725
1727
1726
// Such values are a bit too complex to handle automatically inside $sce.
@@ -2351,10 +2350,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
2351
2350
2352
2351
// support ng-attr-*, ng-prop-* and ng-on-*
2353
2352
ngAttrName = directiveNormalize ( name ) ;
2354
- if ( ngPrefixMatch = ngAttrName . match ( NG_PREFIX_BINDING ) ) {
2355
- isNgAttr = ngPrefixMatch [ 1 ] === " Attr" ;
2356
- isNgProp = ngPrefixMatch [ 1 ] === " Prop" ;
2357
- isNgEvent = ngPrefixMatch [ 1 ] === "On" ;
2353
+ if ( ( ngPrefixMatch = ngAttrName . match ( NG_PREFIX_BINDING ) ) ) {
2354
+ isNgAttr = ngPrefixMatch [ 1 ] === ' Attr' ;
2355
+ isNgProp = ngPrefixMatch [ 1 ] === ' Prop' ;
2356
+ isNgEvent = ngPrefixMatch [ 1 ] === 'On' ;
2358
2357
2359
2358
name = name . replace ( PREFIX_REGEXP , '' )
2360
2359
. substr ( 4 + ngPrefixMatch [ 1 ] . length ) . replace ( / _ ( .) / g, function ( match , letter ) {
@@ -3456,9 +3455,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
3456
3455
}
3457
3456
}
3458
3457
3459
- function getTrustedPropContext ( tag , propNormalizedName ) {
3458
+ function getTrustedPropContext ( nodeName , propNormalizedName ) {
3460
3459
var prop = propNormalizedName . toLowerCase ( ) ;
3461
- return PROP_CONTEXTS [ tag + "|" + prop ] || PROP_CONTEXTS [ "*|" + prop ] ;
3460
+ return PROP_CONTEXTS [ nodeName + "|" + prop ] || PROP_CONTEXTS [ "*|" + prop ] ;
3462
3461
}
3463
3462
3464
3463
function sanitizeSrcsetPropertyValue ( value ) {
@@ -3489,7 +3488,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
3489
3488
return {
3490
3489
pre : function ngPropPreLinkFn ( scope , $element ) {
3491
3490
scope . $watch ( fn , function propertyWatchActionFn ( value ) {
3492
- $element . prop ( propName , value && sanitizer ( value ) ) ;
3491
+ $element . prop ( propName , sanitizer ( value ) ) ;
3493
3492
} ) ;
3494
3493
}
3495
3494
} ;
@@ -3504,8 +3503,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
3504
3503
}
3505
3504
3506
3505
function addAttrInterpolateDirective ( node , directives , value , name , isNgAttr ) {
3507
- var tag = nodeName_ ( node ) ;
3508
- var trustedContext = getTrustedAttrContext ( tag , name ) ;
3506
+ var nodeName = nodeName_ ( node ) ;
3507
+ var trustedContext = getTrustedAttrContext ( nodeName , name ) ;
3509
3508
var mustHaveExpression = ! isNgAttr ;
3510
3509
var allOrNothing = ALL_OR_NOTHING_ATTRS [ name ] || isNgAttr ;
3511
3510
@@ -3514,7 +3513,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
3514
3513
// no interpolation found -> ignore
3515
3514
if ( ! interpolateFn ) return ;
3516
3515
3517
- if ( name === 'multiple' && tag === 'select' ) {
3516
+ if ( name === 'multiple' && nodeName === 'select' ) {
3518
3517
throw $compileMinErr ( 'selmulti' ,
3519
3518
'Binding to the \'multiple\' attribute is not supported. Element: {0}' ,
3520
3519
startingTag ( node ) ) ;
0 commit comments