* Support testing using an element * @param {Function} fn Passed the created element and returns a boolean result
(fn)
| 985 | * @param {Function} fn Passed the created element and returns a boolean result |
| 986 | */ |
| 987 | function assert(fn) { |
| 988 | var el = document.createElement('fieldset'); |
| 989 | |
| 990 | try { |
| 991 | return !!fn(el); |
| 992 | } catch (e) { |
| 993 | return false; |
| 994 | } finally { |
| 995 | // Remove from its parent by default |
| 996 | if (el.parentNode) { |
| 997 | el.parentNode.removeChild(el); |
| 998 | } |
| 999 | |
| 1000 | // release memory in IE |
| 1001 | el = null; |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | /** |
| 1006 | * Returns a function to use in pseudos for input types |
no test coverage detected