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