From: Nicolas Coden Date: Mon, 20 Aug 2018 20:54:18 +0000 (+0200) Subject: fix: fix DropdownMenu body handler check to ignore the element itself X-Git-Tag: v6.6.0~3^2~112^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11465%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: fix DropdownMenu body handler check to ignore the element itself > `andSelf()` is deprecated and should be replaced with `addBack()` > -- @SassNinja Also, `andSelf` cannot be used that way. This commit replace it with the opposite approach: checking if the target is the child of the element or the element itself using `closest()`. --- diff --git a/js/foundation.dropdownMenu.js b/js/foundation.dropdownMenu.js index 338cf5c9f..b2aed651b 100644 --- a/js/foundation.dropdownMenu.js +++ b/js/foundation.dropdownMenu.js @@ -284,7 +284,7 @@ class DropdownMenu extends Plugin { const $body = $(document.body); this._removeBodyHandler(); $body.on('click.zf.dropdownMenu tap.zf.dropdownMenu', (e) => { - var isItself = this.$element.andSelf().find(e.target).length; + var isItself = !!$(e.target).closest(this.$element).length; if (isItself) return; this._hide();