From: Max Beatty Date: Thu, 4 Aug 2016 20:47:30 +0000 (-0700) Subject: prevent navigating to area href when modal target. fixes #18796 X-Git-Tag: v4.0.0-alpha.6~408^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfa714ae1e91e2f77017d02489cbc39fada032c7;p=thirdparty%2Fbootstrap.git prevent navigating to area href when modal target. fixes #18796 --- diff --git a/js/src/modal.js b/js/src/modal.js index 9b3a99ddd7..fd13a687cb 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -491,7 +491,7 @@ const Modal = (($) => { let config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data()) - if (this.tagName === 'A') { + if (this.tagName === 'A' || this.tagName === 'AREA') { event.preventDefault() } diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 28c1e0ec74..7329776bae 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -403,4 +403,26 @@ $(function () { }) .bootstrapModal('show') }) + + QUnit.test('should not follow link in area tag', function (assert) { + assert.expect(2) + var done = assert.async() + + $('') + .appendTo('#qunit-fixture') + + $('