|
4 | 4 |
|
5 | 5 | jQuery.support = {}; |
6 | 6 |
|
7 | | - var root = document.documentElement, |
8 | | - script = document.createElement("script"), |
9 | | - div = document.createElement("div"), |
10 | | - id = "script" + jQuery.now(); |
| 7 | + var div = document.createElement("div"); |
11 | 8 |
|
12 | 9 | div.style.display = "none"; |
13 | 10 | div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
|
64 | 61 | deleteExpando: true, |
65 | 62 | optDisabled: false, |
66 | 63 | checkClone: false, |
67 | | - scriptEval: false, |
| 64 | + scriptEval: null, |
68 | 65 | noCloneEvent: true, |
69 | 66 | boxModel: null, |
70 | 67 | inlineBlockNeedsLayout: false, |
|
77 | 74 | select.disabled = true; |
78 | 75 | jQuery.support.optDisabled = !opt.disabled; |
79 | 76 |
|
80 | | - script.type = "text/javascript"; |
81 | | - try { |
82 | | - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
83 | | - } catch(e) {} |
84 | | - |
85 | | - root.insertBefore( script, root.firstChild ); |
86 | | - |
87 | | - // Make sure that the execution of code works by injecting a script |
88 | | - // tag with appendChild/createTextNode |
89 | | - // (IE doesn't support this, fails, and uses .text instead) |
90 | | - if ( window[ id ] ) { |
91 | | - jQuery.support.scriptEval = true; |
92 | | - delete window[ id ]; |
93 | | - } |
94 | | - |
95 | 77 | // Test to see if it's possible to delete an expando from an element |
96 | 78 | // Fails in Internet Explorer |
97 | 79 | try { |
98 | | - delete script.test; |
| 80 | + delete div.test; |
99 | 81 |
|
100 | 82 | } catch(e) { |
101 | 83 | jQuery.support.deleteExpando = false; |
102 | 84 | } |
103 | 85 |
|
104 | | - root.removeChild( script ); |
105 | | - |
106 | 86 | if ( div.attachEvent && div.fireEvent ) { |
107 | 87 | div.attachEvent("onclick", function click() { |
108 | 88 | // Cloning a node shouldn't copy over any |
|
179 | 159 |
|
180 | 160 | var isSupported = (eventName in el); |
181 | 161 | if ( !isSupported ) { |
182 | | - el.setAttribute(eventName, "return;"); |
| 162 | + el.addEventListener(eventName, function() { return; }, true); |
183 | 163 | isSupported = typeof el[eventName] === "function"; |
184 | 164 | } |
185 | 165 | el = null; |
|
191 | 171 | jQuery.support.changeBubbles = eventSupported("change"); |
192 | 172 |
|
193 | 173 | // release memory in IE |
194 | | - root = script = div = all = a = null; |
| 174 | + div = all = a = null; |
195 | 175 | })(); |
196 | 176 | })( jQuery ); |
0 commit comments