* Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result
( fn )
| 1193 | * @param {Function} fn Passed the created div and expects a boolean result |
| 1194 | */ |
| 1195 | function assert( fn ) { |
| 1196 | var div = document.createElement("div"); |
| 1197 | |
| 1198 | try { |
| 1199 | return !!fn( div ); |
| 1200 | } catch (e) { |
| 1201 | return false; |
| 1202 | } finally { |
| 1203 | // Remove from its parent by default |
| 1204 | if ( div.parentNode ) { |
| 1205 | div.parentNode.removeChild( div ); |
| 1206 | } |
| 1207 | // release memory in IE |
| 1208 | div = null; |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | /** |
| 1213 | * Adds the same handler for all of the specified attrs |