MCPcopy
hub / github.com/layui/layui / assert

Function assert

src/modules/jquery.js:987–1003  ·  view source on GitHub ↗

* Support testing using an element * @param {Function} fn Passed the created element and returns a boolean result

(fn)

Source from the content-addressed store, hash-verified

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

Callers 2

setDocumentFunction · 0.85
jquery.jsFile · 0.85

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected