* Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result
( fn )
| 884 | * @param {Function} fn Passed the created div and expects a boolean result |
| 885 | */ |
| 886 | function assert( fn ) { |
| 887 | var div = document.createElement("div"); |
| 888 | |
| 889 | try { |
| 890 | return !!fn( div ); |
| 891 | } catch (e) { |
| 892 | return false; |
| 893 | } finally { |
| 894 | // Remove from its parent by default |
| 895 | if ( div.parentNode ) { |
| 896 | div.parentNode.removeChild( div ); |
| 897 | } |
| 898 | // release memory in IE |
| 899 | div = null; |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | /** |
| 904 | * Adds the same handler for all of the specified attrs |