MCPcopy
hub / github.com/angular-ui/ui-grid / addPropertyDirective

Function addPropertyDirective

lib/test/angular/1.8.0/angular.js:11134–11172  ·  view source on GitHub ↗
(node, directives, attrName, propName)

Source from the content-addressed store, hash-verified

11132 return sanitizeSrcset($sce.valueOf(value), 'ng-prop-srcset');
11133 }
11134 function addPropertyDirective(node, directives, attrName, propName) {
11135 if (EVENT_HANDLER_ATTR_REGEXP.test(propName)) {
11136 throw $compileMinErr('nodomevents', 'Property bindings for HTML DOM event properties are disallowed');
11137 }
11138
11139 var nodeName = nodeName_(node);
11140 var trustedContext = getTrustedPropContext(nodeName, propName);
11141
11142 var sanitizer = identity;
11143 // Sanitize img[srcset] + source[srcset] values.
11144 if (propName === 'srcset' && (nodeName === 'img' || nodeName === 'source')) {
11145 sanitizer = sanitizeSrcsetPropertyValue;
11146 } else if (trustedContext) {
11147 sanitizer = $sce.getTrusted.bind($sce, trustedContext);
11148 }
11149
11150 directives.push({
11151 priority: 100,
11152 compile: function ngPropCompileFn(_, attr) {
11153 var ngPropGetter = $parse(attr[attrName]);
11154 var ngPropWatch = $parse(attr[attrName], function sceValueOf(val) {
11155 // Unwrap the value to compare the actual inner safe value, not the wrapper object.
11156 return $sce.valueOf(val);
11157 });
11158
11159 return {
11160 pre: function ngPropPreLinkFn(scope, $element) {
11161 function applyPropValue() {
11162 var propValue = ngPropGetter(scope);
11163 $element[0][propName] = sanitizer(propValue);
11164 }
11165
11166 applyPropValue();
11167 scope.$watch(ngPropWatch, applyPropValue);
11168 }
11169 };
11170 }
11171 });
11172 }
11173
11174 function addEventDirective(directives, attrName, eventName) {
11175 directives.push(

Callers 1

collectDirectivesFunction · 0.85

Calls 4

getTrustedPropContextFunction · 0.85
applyPropValueFunction · 0.85
nodeName_Function · 0.70
$parseFunction · 0.70

Tested by

no test coverage detected