MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / csp

Function csp

lib/test/angular/1.7.0/angular.js:1225–1258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1223}
1224
1225var csp = function() {
1226 if (!isDefined(csp.rules)) {
1227
1228
1229 var ngCspElement = (window.document.querySelector('[ng-csp]') ||
1230 window.document.querySelector('[data-ng-csp]'));
1231
1232 if (ngCspElement) {
1233 var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
1234 ngCspElement.getAttribute('data-ng-csp');
1235 csp.rules = {
1236 noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
1237 noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
1238 };
1239 } else {
1240 csp.rules = {
1241 noUnsafeEval: noUnsafeEval(),
1242 noInlineStyle: false
1243 };
1244 }
1245 }
1246
1247 return csp.rules;
1248
1249 function noUnsafeEval() {
1250 try {
1251 // eslint-disable-next-line no-new, no-new-func
1252 new Function('');
1253 return false;
1254 } catch (e) {
1255 return true;
1256 }
1257 }
1258};
1259
1260/**
1261 * @ngdoc directive

Callers 2

$ParseProviderFunction · 0.70
$SnifferProviderFunction · 0.70

Calls 2

isDefinedFunction · 0.70
noUnsafeEvalFunction · 0.70

Tested by

no test coverage detected