diff --git a/src/containers/editable-container.js b/src/containers/editable-container.js index 233f9b5..0c99149 100644 --- a/src/containers/editable-container.js +++ b/src/containers/editable-container.js @@ -20,7 +20,8 @@ Applied as jQuery method. //methods Popup.prototype = { - containerName: null, //tbd in child class + containerName: null, //method to call container on element + containerDataName: null, //object name in element's .data() innerCss: null, //tbd in child class containerClass: 'editable-container editable-popup', //css class applied to container element init: function(element, options) { @@ -121,7 +122,20 @@ Applied as jQuery method. /* returns container object */ container: function() { - return this.$element.data(this.containerDataName || this.containerName); + var container; + //first, try get it by `containerDataName` + if(this.containerDataName) { + if(container = this.$element.data(this.containerDataName)) { + return container; + } + } + //second, try `containerName` + container = this.$element.data(this.containerName); + if(container) { + return container; + } else { + $.error('Can`t get container in element`s .data(). Container: ' + this.containerName); + } }, /* call native method of underlying container, e.g. this.$element.popover('method') */ diff --git a/src/containers/editable-tooltip.js b/src/containers/editable-tooltip.js index ca057d3..0392727 100644 --- a/src/containers/editable-tooltip.js +++ b/src/containers/editable-tooltip.js @@ -9,7 +9,8 @@ //extend methods $.extend($.fn.editableContainer.Popup.prototype, { containerName: 'tooltip', //jQuery method, aplying the widget - containerDataName: 'uiTooltip', //object name in elements .data() (e.g. uiTooltip for tooltip) + //object name in element's .data() + containerDataName: 'ui-tooltip', innerCss: '.ui-tooltip-content', //split options on containerOptions and formOptions @@ -50,15 +51,8 @@ this.call(this.containerOptions); - //disable standart triggering tooltip event - //for some versions of jQueryUI it gives error: - //TypeError: this.container(...)._off is not a function - //see: https://github.com/vitalets/x-editable/issues/32 - if(this.container()._off) { - this.container()._off(this.container().element, 'mouseover focusin'); - } else { - $.error('this.container()._off is not a function. jQuery UI: ' + $.ui.version); - } + //disable standart triggering tooltip events + this.container()._off(this.container().element, 'mouseover focusin'); }, tip: function() {