* Support testing using an element * @param {Function} fn Passed the created element and returns a boolean result
( fn )
| 918 | * @param {Function} fn Passed the created element and returns a boolean result |
| 919 | */ |
| 920 | function assert( fn ) { |
| 921 | var el = document.createElement("fieldset"); |
| 922 | |
| 923 | try { |
| 924 | return !!fn( el ); |
| 925 | } catch (e) { |
| 926 | return false; |
| 927 | } finally { |
| 928 | // Remove from its parent by default |
| 929 | if ( el.parentNode ) { |
| 930 | el.parentNode.removeChild( el ); |
| 931 | } |
| 932 | // release memory in IE |
| 933 | el = null; |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | /** |
| 938 | * Adds the same handler for all of the specified attrs |