Skip to content

Commit f201315

Browse files
authored
Webpack HMR compatibility: update editInPlace.js (#522)
* Update editInPlace.js For HMR compatibility. Fix the javascript error display in console and webpack error overlay : "Failed to execute 'define' on 'CustomElementRegistry': the name "x-trans" has already been used with this registry" * Update DefaultApplyingNodeVisitor.php Fix Translation\Bundle\Tests\Unit\Twig\DefaultApplyingNodeVisitorTest::testApply
1 parent 589beee commit f201315

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Resources/public/js/editInPlace.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
// it is not possible to use HTMLElement directly
1212
class XTrans extends HTMLElement {}
1313

14-
customElements.define("x-trans", XTrans);
15-
14+
if (!customElements.get('x-trans')) {
15+
customElements.define("x-trans", XTrans);
16+
}
17+
1618
return;
1719
}
1820

Twig/Visitor/DefaultApplyingNodeVisitor.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ public function enterNode(Node $node, Environment $env): Node
116116

117117
$expr = new EqualBinary($testNode, $transNode->getNode('node'), $wrappingNode->getTemplateLine());
118118
if (Environment::VERSION_ID >= 31700) {
119-
$expr->setAttribute('operator', 'binary_==');
120-
121119
$condition = new ConditionalTernary(
122120
$expr,
123121
$defaultNode,

0 commit comments

Comments
 (0)