Skip to content

Commit e59418e

Browse files
committed
Merge branch 'dev'
2 parents 5c741eb + 3f00d5f commit e59418e

File tree

5 files changed

+56
-18
lines changed

5 files changed

+56
-18
lines changed

src/dateinput/dateinput.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,12 @@
289289

290290
//{{{ pick
291291

292-
function select(date, conf, e) {
292+
function select(date, conf, e) {
293+
// If it is readonly, then we'll just close the calendar
294+
if (input.attr('readonly')) {
295+
self.hide(e);
296+
return;
297+
}
293298

294299
// current value
295300
value = date;
@@ -402,7 +407,7 @@
402407
$(document).on("click.d", function(e) {
403408
var el = e.target;
404409

405-
if (!$(el).parents("#" + css.root).length && el != input[0] && (!trigger || el != trigger[0])) {
410+
if (!(el.id == css.root || $(el).parents("#" + css.root).length) && el != input[0] && (!trigger || el != trigger[0])) {
406411
self.hide(e);
407412
}
408413

@@ -420,7 +425,7 @@
420425
*/
421426
show: function(e) {
422427

423-
if (input.attr("readonly") || input.attr("disabled") || opened) { return; }
428+
if (input.attr("disabled") || opened) { return; }
424429

425430
// onBeforeShow
426431
e = e || $.Event();

src/toolbox/toolbox.expose.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@
169169
// onBeforeClose
170170
if (call(config.onBeforeClose) === false) { return this; }
171171

172-
mask.fadeOut(config.closeSpeed, function() {
173-
call(config.onClose);
172+
mask.fadeOut(config.closeSpeed, function() {
174173
if (exposed) {
175174
exposed.css({zIndex: overlayIndex});
176175
}
177176
loaded = false;
177+
call(config.onClose);
178178
});
179179

180180
// unbind various event listeners

src/tooltip/tooltip.dynamic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767

6868
var confOrigin = $.extend(true,{},conf),
6969
cls = conf.classNames.split(/\s/),
70-
orig;
71-
70+
orig, ret;
71+
7272
this.each(function() {
7373

7474
var api = $(this).tooltip().onBeforeShow(function(e, pos) {

src/tooltip/tooltip.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,23 @@
100100
left = conf.relative ? trigger.position().left : trigger.offset().left,
101101
pos = conf.position[0];
102102

103-
top -= tip.outerHeight() - conf.offset[0];
104-
left += trigger.outerWidth() + conf.offset[1];
103+
top -= tip.outerHeight(false) - conf.offset[0];
104+
left += trigger.outerWidth(false) + conf.offset[1];
105105

106106
// iPad position fix
107107
if (/iPad/i.test(navigator.userAgent)) {
108108
top -= $(window).scrollTop();
109109
}
110110

111111
// adjust Y
112-
var height = tip.outerHeight() + trigger.outerHeight();
112+
var height = tip.outerHeight(false) + trigger.outerHeight(false);
113113
if (pos == 'center') { top += height / 2; }
114114
if (pos == 'bottom') { top += height; }
115115

116116

117117
// adjust X
118118
pos = conf.position[1];
119-
var width = tip.outerWidth() + trigger.outerWidth();
119+
var width = tip.outerWidth(false) + trigger.outerWidth(false);
120120
if (pos == 'center') { left -= width / 2; }
121121
if (pos == 'left') { left -= width; }
122122

@@ -203,7 +203,8 @@
203203

204204
// manual tooltip
205205
} else {
206-
tip = trigger.next();
206+
tip = trigger.find('.' + conf.tipClass);
207+
if (!tip.length) { tip = trigger.next(); }
207208
if (!tip.length) { tip = trigger.parent().next(); }
208209
}
209210

@@ -331,10 +332,6 @@
331332

332333
// jQuery plugin implementation
333334
$.fn.tooltip = function(conf) {
334-
335-
// return existing instance
336-
var api = this.data("tooltip");
337-
if (api) { return api; }
338335

339336
conf = $.extend(true, {}, $.tools.tooltip.conf, conf);
340337

@@ -344,9 +341,12 @@
344341
}
345342

346343
// install tooltip for each entry in jQuery object
344+
// that is not an existing instance
347345
this.each(function() {
348-
api = new Tooltip($(this), conf);
349-
$(this).data("tooltip", api);
346+
if ( $(this).data("tooltip")===null){
347+
api = new Tooltip($(this), conf);
348+
$(this).data("tooltip", api);
349+
};
350350
});
351351

352352
return conf.api ? api: this;

test/tooltip/index.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,39 @@ <h3>Manual tooltip</h3>
107107

108108
</div>
109109

110+
<div id="manual-enclosed" class="test">
111+
112+
<h3>Manual enclosed tooltip</h3>
113+
114+
<table>
115+
<tbody>
116+
<tr>
117+
<td class="trigger">
118+
trigger 1
119+
<div class="tooltip">Manual enclosed #1</div>
120+
</td>
121+
<td class="trigger">
122+
trigger 2
123+
<div class="tooltip">Manual enclosed #2</div>
124+
</td>
125+
<td class="trigger">
126+
trigger 3
127+
<div class="tooltip">Manual enclosed #3</div>
128+
</td>
129+
</tr>
130+
</tbody>
131+
</table>
132+
133+
<script>
134+
$("#manual-enclosed td").tooltip({
135+
delay: 300,
136+
predelay: 0,
137+
effect: 'fade'
138+
});
139+
</script>
140+
141+
</div>
142+
110143
<div id="same" class="test">
111144

112145
<h3>Same tip element</h3>

0 commit comments

Comments
 (0)