Skip to content

Commit 80775ab

Browse files
committed
Switches to inline automatically if no popup activator element found (instead of erroring)
1 parent c996e88 commit 80775ab

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/definitions/modules/calendar.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,8 @@
6363
module.debug('Initializing calendar for', element);
6464

6565
isTouch = module.get.isTouch();
66-
if (settings.inline) {
67-
module.setup.inline();
68-
} else {
69-
module.setup.popup();
70-
}
66+
module.setup.popup();
67+
module.setup.inline();
7168
module.setup.input();
7269
module.create.calendar();
7370

@@ -89,17 +86,19 @@
8986

9087
setup: {
9188
popup: function () {
92-
if ($.fn.popup === undefined) {
93-
module.error(error.popup);
89+
if (settings.inline) {
9490
return;
9591
}
9692
if (!$activator.length) {
9793
$activator = $module.children().first();
9894
if (!$activator.length) {
99-
module.error(error.activator);
10095
return;
10196
}
10297
}
98+
if ($.fn.popup === undefined) {
99+
module.error(error.popup);
100+
return;
101+
}
103102
if (!$container.length) {
104103
//prepend the popup element to the activator's parent so that it has less chance of messing with
105104
//the styling (eg input action button needs to be the last child to have correct border radius)
@@ -137,6 +136,9 @@
137136
module.popup(options);
138137
},
139138
inline: function () {
139+
if ($activator.length && !settings.inline) {
140+
return;
141+
}
140142
$container = $('<div/>').addClass(className.calendar).appendTo($module);
141143
if (!$input.length) {
142144
$container.attr('tabindex', '0');
@@ -805,7 +807,6 @@
805807

806808
error: {
807809
popup: 'UI Popup, a required component is not included in this page',
808-
activator: 'No activator found for the calendar popup',
809810
method: 'The method you called is not defined.'
810811
},
811812

0 commit comments

Comments
 (0)