MCPcopy Create free account
hub / github.com/JsAaron/jQuery / assert

Function assert

2.1.1/test/jquery-2.1.1.js:878–893  ·  view source on GitHub ↗

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

( fn )

Source from the content-addressed store, hash-verified

876 * @param {Function} fn Passed the created div and expects a boolean result
877 */
878function assert( fn ) {
879 var div = document.createElement("div");
880
881 try {
882 return !!fn( div );
883 } catch (e) {
884 return false;
885 } finally {
886 // Remove from its parent by default
887 if ( div.parentNode ) {
888 div.parentNode.removeChild( div );
889 }
890 // release memory in IE
891 div = null;
892 }
893}
894
895/**
896 * Adds the same handler for all of the specified attrs

Callers 1

jquery-2.1.1.jsFile · 0.70

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected