MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / assert

Function assert

public/localscripts/calculationQuestion/jquery.js:1192–1207  ·  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

1190 * @param {Function} fn Passed the created div and expects a boolean result
1191 */
1192function assert( fn ) {
1193 var div = document.createElement("div");
1194
1195 try {
1196 return !!fn( div );
1197 } catch (e) {
1198 return false;
1199 } finally {
1200 // Remove from its parent by default
1201 if ( div.parentNode ) {
1202 div.parentNode.removeChild( div );
1203 }
1204 // release memory in IE
1205 div = null;
1206 }
1207}
1208
1209/**
1210 * Adds the same handler for all of the specified attrs

Callers 10

jquery.jsFile · 0.85
getCourseInstanceUrlFunction · 0.85
getQuestionUrlFunction · 0.85
getQuestionSubmitInfoFunction · 0.85
postQuestionAnswerFunction · 0.85
util.jsFile · 0.85
initialSync.jsFile · 0.85
questionsSync.jsFile · 0.85

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected