* Support testing using an element * @param {Function} fn Passed the created element and returns a boolean result
( fn )
| 934 | * @param {Function} fn Passed the created element and returns a boolean result |
| 935 | */ |
| 936 | function assert( fn ) { |
| 937 | var el = document.createElement( "fieldset" ); |
| 938 | |
| 939 | try { |
| 940 | return !!fn( el ); |
| 941 | } catch ( e ) { |
| 942 | return false; |
| 943 | } finally { |
| 944 | |
| 945 | // Remove from its parent by default |
| 946 | if ( el.parentNode ) { |
| 947 | el.parentNode.removeChild( el ); |
| 948 | } |
| 949 | |
| 950 | // release memory in IE |
| 951 | el = null; |
| 952 | } |
| 953 | } |
| 954 | |
| 955 | /** |
| 956 | * Adds the same handler for all of the specified attrs |