MCPcopy
hub / github.com/jquery/jquery / DOMEval

Function DOMEval

test/data/jquery-3.7.1.js:104–131  ·  view source on GitHub ↗
( code, node, doc )

Source from the content-addressed store, hash-verified

102 };
103
104 function DOMEval( code, node, doc ) {
105 doc = doc || document;
106
107 var i, val,
108 script = doc.createElement( "script" );
109
110 script.text = code;
111 if ( node ) {
112 for ( i in preservedScriptAttributes ) {
113
114 // Support: Firefox 64+, Edge 18+
115 // Some browsers don't support the "nonce" property on scripts.
116 // On the other hand, just using `getAttribute` is not enough as
117 // the `nonce` attribute is reset to an empty string whenever it
118 // becomes browsing-context connected.
119 // See https://github.com/whatwg/html/issues/2369
120 // See https://html.spec.whatwg.org/#nonce-attributes
121 // The `node.getAttribute` check was added for the sake of
122 // `jQuery.globalEval` so that it can fake a nonce-containing node
123 // via an object.
124 val = node[ i ] || node.getAttribute && node.getAttribute( i );
125 if ( val ) {
126 script.setAttribute( i, val );
127 }
128 }
129 }
130 doc.head.appendChild( script ).parentNode.removeChild( script );
131 }
132
133
134function toType( obj ) {

Callers 2

jquery-3.7.1.jsFile · 0.70
domManipFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected