@@ -38,7 +38,6 @@ export function createOc(oc) {
3838 let renderedComponents = oc . renderedComponents ;
3939 let dataRenderedAttribute = "data-rendered" ;
4040 let dataRenderingAttribute = "data-rendering" ;
41- let nonce = ocConf . nonce ;
4241 let logError = ( msg ) => console . log ( msg ) ;
4342 let logInfo = ( msg ) => ocConf . debug && console . log ( msg ) ;
4443 let handleFetchResponse = ( response ) => {
@@ -125,8 +124,8 @@ export function createOc(oc) {
125124 for ( let attribute of Array . from ( script . attributes ) ) {
126125 newScript . setAttribute ( attribute . name , attribute . value ) ;
127126 }
128- if ( nonce ) {
129- newScript . setAttribute ( "nonce" , nonce ) ;
127+ if ( ocConf . cspNonce ) {
128+ newScript . setAttribute ( "nonce" , ocConf . cspNonce ) ;
130129 }
131130 script . parentNode ?. replaceChild ( newScript , script ) ;
132131 }
@@ -144,8 +143,8 @@ export function createOc(oc) {
144143 oc . addStylesToHead = ( styles ) => {
145144 let style = $document . createElement ( "style" ) ;
146145 style . textContent = styles ;
147- if ( nonce ) {
148- style . setAttribute ( "nonce" , nonce ) ;
146+ if ( ocConf . cspNonce ) {
147+ style . setAttribute ( "nonce" , ocConf . cspNonce ) ;
149148 }
150149 $document . head . appendChild ( style ) ;
151150 } ;
0 commit comments