diff --git a/js/popover.js b/js/popover.js index db272bdee412..86f1588d7d2a 100644 --- a/js/popover.js +++ b/js/popover.js @@ -89,16 +89,12 @@ var $this = $(this) var data = $this.data('bs.popover') var options = typeof option == 'object' && option - var selector = options && options.selector + var selector = options && options.selector || '' if (!data && option == 'destroy') return - if (selector) { - if (!data) $this.data('bs.popover', (data = {})) - if (!data[selector]) data[selector] = new Popover(this, options) - } else { - if (!data) $this.data('bs.popover', (data = new Popover(this, options))) - } - if (typeof option == 'string') data[option]() + if (!data) $this.data('bs.popover', (data = {})) + if (!data[selector]) data[selector] = new Popover(this, options) + if (typeof option == 'string') data[selector][option]() }) } diff --git a/js/tooltip.js b/js/tooltip.js index cda147d9c701..c84a19aa8976 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -448,16 +448,12 @@ var $this = $(this) var data = $this.data('bs.tooltip') var options = typeof option == 'object' && option - var selector = options && options.selector + var selector = options && options.selector || '' if (!data && option == 'destroy') return - if (selector) { - if (!data) $this.data('bs.tooltip', (data = {})) - if (!data[selector]) data[selector] = new Tooltip(this, options) - } else { - if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) - } - if (typeof option == 'string') data[option]() + if (!data) $this.data('bs.tooltip', (data = {})) + if (!data[selector]) data[selector] = new Tooltip(this, options) + if (typeof option == 'string') data[selector][option]() }) }