Fixes #194, multiple language input not working if hitting p
authorAlexander Ebert <ebert@woltlab.com>
Tue, 27 Sep 2011 13:14:57 +0000 (15:14 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 27 Sep 2011 13:14:57 +0000 (15:14 +0200)
wcfsetup/install/files/js/WCF.js

index 852c8743195f85d2e1a2a9a4dba9b0a8e21fd882..abe9eed14854e0cca18ed773c354c58e90749a3d 100644 (file)
@@ -1649,13 +1649,12 @@ WCF.MultipleLanguageInput.prototype = {
                this._element.wrap('<div class="preInput" />');
                var $wrapper = this._element.parent();
                var $button = $('<p class="dropdownCaption"><span>enable i18n</span></p>').prependTo($wrapper);
-               var $span = $button.children('span');
 
-               $span.click($.proxy(this._enable, this));
+               $button.click($.proxy(this._enable, this));
                WCF.CloseOverlayHandler.addCallback(this._element.wcfIdentify(), $.proxy(this._closeSelection, this));
                
                if (enableOnInit) {
-                       $span.trigger('click');
+                       $button.trigger('click');
 
                        // pre-select current language
                        this._list.children('li').each($.proxy(function(index, listItem) {
@@ -1675,6 +1674,10 @@ WCF.MultipleLanguageInput.prototype = {
        _enable: function(event) {
                if (!this._isEnabled) {
                        var $button = $(event.target);
+                       if ($button.getTagName() == 'p') {
+                               $button = $button.children('span');
+                       }
+
                        $button.addClass('active');
 
                        // insert list