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

Function assert

迷你jQuery/sizzle.js:346–361  ·  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

344 */
345
346 function assert(fn) {
347 var div = document.createElement("div");
348
349 try {
350 return !!fn(div);
351 } catch (e) {
352 return false;
353 } finally {
354 // Remove from its parent by default
355 if (div.parentNode) {
356 div.parentNode.removeChild(div);
357 }
358 // release memory in IE
359 div = null;
360 }
361 }
362
363 /**
364 * Adds the same handler for all of the specified attrs

Callers 1

sizzle.jsFile · 0.70

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected