Skip to content

Commit

Permalink
bug: js error use own object extends HTMLElement (#493)
Browse files Browse the repository at this point in the history
* bug: js error use own object extends HTMLElement

* refac: remove unnecessary phpdoc

* refac: remove old sf 4 stuff
  • Loading branch information
gimler authored Sep 12, 2023
1 parent 1eb4d47 commit cdeaa4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
11 changes: 0 additions & 11 deletions EventListener/AutoAddMissingTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Translation\Bundle\EventListener;

use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpKernel\Event\TerminateEvent;
use Symfony\Component\Translation\DataCollectorTranslator;
use Translation\Bundle\Service\StorageService;
Expand All @@ -32,9 +31,6 @@ final class AutoAddMissingTranslations
*/
private $storage;

/**
* @param DataCollectorTranslator $translator
*/
public function __construct(StorageService $storage, DataCollectorTranslator $translator = null)
{
$this->dataCollector = $translator;
Expand All @@ -56,10 +52,3 @@ public function onTerminate(TerminateEvent $event): void
}
}
}

// PostResponseEvent have been renamed into ResponseEvent in sf 4.3
// @see https://github.com/symfony/symfony/blob/master/UPGRADE-4.3.md#httpkernel
// To be removed once sf ^4.3 become the minimum supported version.
if (!class_exists(TerminateEvent::class) && class_exists(PostResponseEvent::class)) {
class_alias(PostResponseEvent::class, TerminateEvent::class);
}
8 changes: 0 additions & 8 deletions EventListener/EditInPlaceResponseListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Translation\Bundle\EventListener;

use Symfony\Component\Asset\Packages;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Translation\Bundle\EditInPlace\ActivatorInterface;
Expand Down Expand Up @@ -128,10 +127,3 @@ public function onKernelResponse(ResponseEvent $event): void
$event->getResponse()->setContent($content);
}
}

// FilterResponseEvent have been renamed into ResponseEvent in sf 4.3
// @see https://github.com/symfony/symfony/blob/master/UPGRADE-4.3.md#httpkernel
// To be removed once sf ^4.3 become the minimum supported version.
if (!class_exists(ResponseEvent::class) && class_exists(FilterResponseEvent::class)) {
class_alias(FilterResponseEvent::class, ResponseEvent::class);
}
5 changes: 4 additions & 1 deletion Resources/public/js/editInPlace.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
*/
(function () {
if (typeof customElements.define !== "undefined") {
customElements.define("x-trans", HTMLElement);
// it is not possible to use HTMLElement directly
class XTrans extends HTMLElement {}

customElements.define("x-trans", XTrans);

return;
}
Expand Down

0 comments on commit cdeaa4d

Please sign in to comment.