[BUGFIX] Remove style attribute in LiveSearch 40/54440/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 18 Oct 2017 19:49:36 +0000 (21:49 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 18 Oct 2017 20:22:37 +0000 (22:22 +0200)
Currently, `beforeRender` removes some inline CSS so adjust the layout
of the suggest list. If the first search has no result, the layout is
broken because `beforeRender` is not called in case there are no results.

This patch removes the style attribute as early as possible.

Resolves: #82757
Releases: master, 8.7
Change-Id: I844b81aca43bd469dfdbb46516366f4786d0935f
Reviewed-on: https://review.typo3.org/54440
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js

index 1120d6f..330f624 100644 (file)
@@ -89,8 +89,7 @@ define([
                                }
                        },
                        beforeRender: function(container) {
-                               // Unset height, width and z-index again, should be fixed by the plugin at a later point
-                               container.attr('style', '').append('<hr><div>' +
+                               container.append('<hr><div>' +
                                        '<a href="#" class="btn btn-primary pull-right t3js-live-search-show-all">' +
                                                TYPO3.LLL.liveSearch.showAllResults +
                                        '</a>' +
@@ -119,6 +118,9 @@ define([
                        $(searchFieldSelector).val('').trigger('change');
                });
 
+               // Unset height, width and z-index
+               $(toolbarItem).removeAttr('style');
+
                $(searchFieldSelector).clearable({
                        onClear: function() {
                                if ($(toolbarItem).hasClass('open')) {