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

Function csp

lib/test/angular/1.5.0/angular.js:1089–1123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1087}
1088
1089var csp = function() {
1090 if (!isDefined(csp.rules)) {
1091
1092
1093 var ngCspElement = (document.querySelector('[ng-csp]') ||
1094 document.querySelector('[data-ng-csp]'));
1095
1096 if (ngCspElement) {
1097 var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
1098 ngCspElement.getAttribute('data-ng-csp');
1099 csp.rules = {
1100 noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
1101 noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
1102 };
1103 } else {
1104 csp.rules = {
1105 noUnsafeEval: noUnsafeEval(),
1106 noInlineStyle: false
1107 };
1108 }
1109 }
1110
1111 return csp.rules;
1112
1113 function noUnsafeEval() {
1114 try {
1115 /* jshint -W031, -W054 */
1116 new Function('');
1117 /* jshint +W031, +W054 */
1118 return false;
1119 } catch (e) {
1120 return true;
1121 }
1122 }
1123};
1124
1125/**
1126 * @ngdoc directive

Callers 2

$ParseProviderFunction · 0.70
$SnifferProviderFunction · 0.70

Calls 2

isDefinedFunction · 0.70
noUnsafeEvalFunction · 0.70

Tested by

no test coverage detected