diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index e99e89c57..2607be0ba 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -76,6 +76,7 @@ - **Menu** - `tiered menu` has been removed - **Menu** - Increased contrast on `inverted` menu selection for legibility - **Message** - Slightly increases `box-shadow` +- **Popup** - Popup no longer produces an error when a position cannot be found on the page. - **Segment** - **Clearfix** has been removed from `ui segment` - **Search** - Slightly adjusted search result theme for clarity - **Site** - Increase contrast on default hovered/down colors for colored variations @@ -117,6 +118,7 @@ - **Modal** - `scrollable modal` now correctly adds padding below modal - **Modal** - Modal with `detachable: false` inside `ui sidebar` `pusher` element will now show correctly - **Popup** - Fixes issue with `min-width` in firefox exceeding `max-width` causing element to not wrap correctly +- **Popup** - Popup will now produce an error message and not mistakenly appear in the top left corner of page, if called with a `popup` or `target` that does not exist. - **Popup** - Fixed bug which could cause pre-existing inline popup to be removed from DOM after hiding - **Reveal** - Removed `masked` reveal, all reveals are masked by default - **Search** - Search will no longer incorrectly produce an error when API settings are passed through metadata diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js index 42c50ffe9..36609665a 100644 --- a/src/definitions/modules/popup.js +++ b/src/definitions/modules/popup.js @@ -598,6 +598,10 @@ $.fn.popup = function(parameters) { set: { position: function(position, arrowOffset) { + if($target.length == 0 || $popup.length == 0) { + module.error(error.notFound); + return; + } var windowWidth = $(window).width(), windowHeight = $(window).height(), @@ -761,7 +765,7 @@ $.fn.popup = function(parameters) { } else if(!settings.lastResort) { module.debug('Popup could not find a position in view', $popup); - module.error(error.cannotPlace, element); + // module.error(error.cannotPlace, element); module.remove.attempts(); module.remove.loading(); module.reset(); @@ -1176,7 +1180,8 @@ $.fn.popup.settings = { error: { invalidPosition : 'The position you specified is not a valid position', cannotPlace : 'No visible position could be found for the popup', - method : 'The method you called is not defined.' + method : 'The method you called is not defined.', + notFound : 'The target or popup you specified does not exist on the page' }, metadata: {