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

Function csp

lib/test/angular/1.8.0/angular.js:1265–1298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1263}
1264
1265var csp = function() {
1266 if (!isDefined(csp.rules)) {
1267
1268
1269 var ngCspElement = (window.document.querySelector('[ng-csp]') ||
1270 window.document.querySelector('[data-ng-csp]'));
1271
1272 if (ngCspElement) {
1273 var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
1274 ngCspElement.getAttribute('data-ng-csp');
1275 csp.rules = {
1276 noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
1277 noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
1278 };
1279 } else {
1280 csp.rules = {
1281 noUnsafeEval: noUnsafeEval(),
1282 noInlineStyle: false
1283 };
1284 }
1285 }
1286
1287 return csp.rules;
1288
1289 function noUnsafeEval() {
1290 try {
1291 // eslint-disable-next-line no-new, no-new-func
1292 new Function('');
1293 return false;
1294 } catch (e) {
1295 return true;
1296 }
1297 }
1298};
1299
1300/**
1301 * @ngdoc directive

Callers 2

$ParseProviderFunction · 0.70
$SnifferProviderFunction · 0.70

Calls 2

isDefinedFunction · 0.70
noUnsafeEvalFunction · 0.70

Tested by

no test coverage detected