Fixed broken clear content in popovers
authorMarcel Werk <burntime@woltlab.com>
Wed, 24 Aug 2016 15:18:32 +0000 (17:18 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 24 Aug 2016 15:18:37 +0000 (17:18 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Popover.js

index a10ac9f8920f01504ace4d4fada71a96844b94d6..9434bf12bcb5f00f71f5e72503264c24f9983fb5 100644 (file)
@@ -200,7 +200,9 @@ define(['Ajax', 'Dictionary', 'Environment', 'Dom/ChangeListener', 'Dom/Util', '
                                throw new Error("Unable to find element for object id '" + objectId + "' (identifier: '" + identifier + "').");
                        }
                        
-                       data.content = DomUtil.createFragmentFromHtml(content);
+                       var fragment = DomUtil.createFragmentFromHtml(content);
+                       if (!fragment.childElementCount) fragment = DomUtil.createFragmentFromHtml('<p>' + content + '</p>');
+                       data.content = fragment;
                        data.state = STATE_READY;
                        
                        if (_activeId) {
@@ -298,6 +300,7 @@ define(['Ajax', 'Dictionary', 'Environment', 'Dom/ChangeListener', 'Dom/Util', '
                                _popover.classList.add('forceHide');
                                
                                // force layout
+                               //noinspection BadExpressionStatementJS
                                _popover.offsetTop;
                                
                                this._clearContent();