From e93829d064f91aa5a3511f62cc29890b51d42eac Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 14 Nov 2011 16:51:44 +0100 Subject: [PATCH] .data() now supports upper-case 'ID' suffix --- wcfsetup/install/files/js/WCF.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index aa963eec6c..69f659d833 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -6,6 +6,26 @@ * @license GNU Lesser General Public License */ +(function() { + // store original implementation + var $jQueryData = jQuery.fn.data; + + /** + * Override jQuery.fn.data() to support custom 'ID' suffix which will + * be translated to '-id' at runtime. + * + * @see jQuery.fn.data() + */ + jQuery.fn.data = function(key, value) { + if (key.indexOf('ID') > 0) { + arguments[0] = key.replace('ID', '-id'); + } + + // call jQuery's own data method + return $jQueryData.apply(this, arguments); + } +})(); + /* Simple JavaScript Inheritance * By John Resig http://ejohn.org/ * MIT Licensed. @@ -3007,7 +3027,7 @@ $.widget('ui.wcfSidebar', { */ _create: function() { this.element.wrap('
'); - this._container = this.element.parents('aside:eq(0)'); + this._container = this.element.parent('div'); // create toggle button this._button = $('').appendTo(this._container); -- 2.20.1