(node, directives, attrName, propName)
| 11067 | return sanitizeSrcset($sce.valueOf(value), 'ng-prop-srcset'); |
| 11068 | } |
| 11069 | function addPropertyDirective(node, directives, attrName, propName) { |
| 11070 | if (EVENT_HANDLER_ATTR_REGEXP.test(propName)) { |
| 11071 | throw $compileMinErr('nodomevents', 'Property bindings for HTML DOM event properties are disallowed'); |
| 11072 | } |
| 11073 | |
| 11074 | var nodeName = nodeName_(node); |
| 11075 | var trustedContext = getTrustedPropContext(nodeName, propName); |
| 11076 | |
| 11077 | var sanitizer = identity; |
| 11078 | // Sanitize img[srcset] + source[srcset] values. |
| 11079 | if (propName === 'srcset' && (nodeName === 'img' || nodeName === 'source')) { |
| 11080 | sanitizer = sanitizeSrcsetPropertyValue; |
| 11081 | } else if (trustedContext) { |
| 11082 | sanitizer = $sce.getTrusted.bind($sce, trustedContext); |
| 11083 | } |
| 11084 | |
| 11085 | directives.push({ |
| 11086 | priority: 100, |
| 11087 | compile: function ngPropCompileFn(_, attr) { |
| 11088 | var ngPropGetter = $parse(attr[attrName]); |
| 11089 | var ngPropWatch = $parse(attr[attrName], function sceValueOf(val) { |
| 11090 | // Unwrap the value to compare the actual inner safe value, not the wrapper object. |
| 11091 | return $sce.valueOf(val); |
| 11092 | }); |
| 11093 | |
| 11094 | return { |
| 11095 | pre: function ngPropPreLinkFn(scope, $element) { |
| 11096 | function applyPropValue() { |
| 11097 | var propValue = ngPropGetter(scope); |
| 11098 | $element[0][propName] = sanitizer(propValue); |
| 11099 | } |
| 11100 | |
| 11101 | applyPropValue(); |
| 11102 | scope.$watch(ngPropWatch, applyPropValue); |
| 11103 | } |
| 11104 | }; |
| 11105 | } |
| 11106 | }); |
| 11107 | } |
| 11108 | |
| 11109 | function addEventDirective(directives, attrName, eventName) { |
| 11110 | directives.push( |
no test coverage detected