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

Function csp

lib/test/angular/1.6.7/angular.js:1257–1290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 2

$ParseProviderFunction · 0.70
$SnifferProviderFunction · 0.70

Calls 2

isDefinedFunction · 0.70
noUnsafeEvalFunction · 0.70

Tested by

no test coverage detected