!function(){var moduleFactory=function($){var module=this,exports=function(){var oldClosest=$.fn.closest;$.fn.closest=function(selectors,context){var res,result,i,selector,selector,rooted={},rootedIsEmpty=!0,selectorsArr=selectors;if("string"==typeof selectors&&(selectorsArr=[selectors]),$.each(selectorsArr,function(i,selector){if(0==selector.indexOf(">")){if(-1!=selector.indexOf(" "))throw" closest does not work with > followed by spaces!";rooted[selectorsArr[i]=selector.substr(1)]=selector,"string"==typeof selectors&&(selectors=selector.substr(1)),rootedIsEmpty=!1
}}),res=oldClosest.call(this,selectors,context),rootedIsEmpty)return res;for(i=0;i<res.length;)result=res[i],selector=result.selector,void 0===rooted[selector]||(result.selector=rooted[selector],rooted[selector]=!1,"string"==typeof result.selector&&result.elem.parentNode===context)?i++:res.splice(i,1);return res}};exports(),module.resolveWith(exports)};dispatch("mvc/dom.closest").containing(moduleFactory).to("Foundry/2.1 Modules")}();