From: Alexander Ebert Date: Mon, 14 Nov 2011 15:51:44 +0000 (+0100) Subject: .data() now supports upper-case 'ID' suffix X-Git-Tag: 2.0.0_Beta_1~1591^2~13 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e93829d064f91aa5a3511f62cc29890b51d42eac;p=GitHub%2FWoltLab%2FWCF.git .data() now supports upper-case 'ID' suffix --- 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);