Skip to content

Commit 86121ef

Browse files
authored
feat(toast,modal): support short notation $.
This PR adds jquery short notation support ($.) to toast and modal which are made dynamically out of js properties and thus are not bound to an existing dom node. Previously you always had to select body (which still works) when no existing domnode template exists. Infact the body selector was completely ignored.
1 parent df9b52b commit 86121ef

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/definitions/modules/modal.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ window = (typeof window != 'undefined' && window.Math == Math)
2323
: Function('return this')()
2424
;
2525

26-
$.fn.modal = function(parameters) {
26+
$.modal = $.fn.modal = function(parameters) {
2727
var
2828
$allModules = $(this),
2929
$window = $(window),
@@ -75,8 +75,10 @@ $.fn.modal = function(parameters) {
7575
$dimmable,
7676
$dimmer,
7777

78+
isModalComponent = $module.hasClass('modal'),
79+
7880
element = this,
79-
instance = $module.hasClass('modal') ? $module.data(moduleNamespace) : undefined,
81+
instance = isModalComponent ? $module.data(moduleNamespace) : undefined,
8082

8183
ignoreRepeatedEvents = false,
8284

@@ -94,7 +96,7 @@ $.fn.modal = function(parameters) {
9496

9597
initialize: function() {
9698
module.create.id();
97-
if(!$module.hasClass('modal')) {
99+
if(!isModalComponent) {
98100
module.create.modal();
99101
if(!$.isFunction(settings.onHidden)) {
100102
settings.onHidden = function () {

src/definitions/modules/toast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ window = (typeof window != 'undefined' && window.Math == Math)
2323
: Function('return this')()
2424
;
2525

26-
$.fn.toast = function(parameters) {
26+
$.toast = $.fn.toast = function(parameters) {
2727
var
2828
$allModules = $(this),
2929
moduleSelector = $allModules.selector || '',

0 commit comments

Comments
 (0)