Skip to content

Commit 935cb2c

Browse files
committed
Revert #47715
1 parent 66d929d commit 935cb2c

11 files changed

+16
-18
lines changed

Resources/views/Form/form_div_layout.html.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{# Attribute "required" is not supported #}
1515
{%- set required = false -%}
1616
{%- endif -%}
17-
<input type="{{ type }}" {{ block('widget_attributes') }}{% if value is not empty %} value="{{ value }}"{% endif %}>
17+
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
1818
{%- endblock form_widget_simple -%}
1919

2020
{%- block form_widget_compound -%}
@@ -91,11 +91,11 @@
9191
{%- endblock choice_widget_options -%}
9292

9393
{%- block checkbox_widget -%}
94-
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %}>
94+
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
9595
{%- endblock checkbox_widget -%}
9696

9797
{%- block radio_widget -%}
98-
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %}>
98+
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
9999
{%- endblock radio_widget -%}
100100

101101
{%- block datetime_widget -%}
@@ -402,7 +402,7 @@
402402
{%- endif -%}
403403
<form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}>
404404
{%- if form_method != method -%}
405-
<input type="hidden" name="_method" value="{{ method }}">
405+
<input type="hidden" name="_method" value="{{ method }}" />
406406
{%- endif -%}
407407
{%- endblock form_start -%}
408408

@@ -440,7 +440,7 @@
440440
{%- endif -%}
441441

442442
{%- if form_method != method -%}
443-
<input type="hidden" name="_method" value="{{ method }}">
443+
<input type="hidden" name="_method" value="{{ method }}" />
444444
{%- endif -%}
445445
{% endif -%}
446446
{% endblock form_rest %}

Test/FormLayoutTestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ protected function assertMatchesXpath($html, $expression, $count = 1): void
5252
{
5353
$dom = new \DOMDocument('UTF-8');
5454

55-
$html = preg_replace('/(<input [^>]+)(?<!\/)>/', '$1/>', $html);
56-
5755
try {
5856
// Wrap in <root> node so we can load HTML with multiple tags at
5957
// the top level

Tests/Extension/AbstractBootstrap3LayoutTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,7 +2797,7 @@ public function testWidgetAttributes()
27972797
$html = $this->renderWidget($form->createView());
27982798

27992799
// compare plain HTML to check the whitespace
2800-
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar form-control" data-foo="bar" value="value">', $html);
2800+
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar form-control" data-foo="bar" value="value" />', $html);
28012801
}
28022802

28032803
public function testWidgetAttributeNameRepeatedIfTrue()
@@ -2809,7 +2809,7 @@ public function testWidgetAttributeNameRepeatedIfTrue()
28092809
$html = $this->renderWidget($form->createView());
28102810

28112811
// foo="foo"
2812-
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" class="form-control" value="value">', $html);
2812+
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" class="form-control" value="value" />', $html);
28132813
}
28142814

28152815
public function testButtonAttributes()

Tests/Extension/AbstractLayoutTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,7 +2448,7 @@ public function testWidgetAttributes()
24482448
$html = $this->renderWidget($form->createView());
24492449

24502450
// compare plain HTML to check the whitespace
2451-
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar" data-foo="bar" value="value">', $html);
2451+
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar" data-foo="bar" value="value" />', $html);
24522452
}
24532453

24542454
public function testWidgetAttributeNameRepeatedIfTrue()
@@ -2460,7 +2460,7 @@ public function testWidgetAttributeNameRepeatedIfTrue()
24602460
$html = $this->renderWidget($form->createView());
24612461

24622462
// foo="foo"
2463-
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" value="value">', $html);
2463+
$this->assertSame('<input type="text" id="text" name="text" required="required" foo="foo" value="value" />', $html);
24642464
}
24652465

24662466
public function testWidgetAttributeHiddenIfFalse()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% block form_widget_simple %}
22
{%- set type = type|default('text') -%}
3-
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme">
3+
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
44
{%- endblock form_widget_simple %}

Tests/Extension/Fixtures/templates/form/theme_extends.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
{% block form_widget_simple %}
44
{%- set type = type|default('text') -%}
5-
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme">
5+
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
66
{%- endblock form_widget_simple %}

Tests/Extension/Fixtures/templates/form/theme_use.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
{% block form_widget_simple %}
44
{%- set type = type|default('text') -%}
5-
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme">
5+
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" rel="theme" />
66
{%- endblock form_widget_simple %}

Tests/Extension/FormExtensionBootstrap3LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testMoneyWidgetInIso()
7171
$this->assertSame(<<<'HTML'
7272
<div class="input-group">
7373
<span class="input-group-addon">&euro; </span>
74-
<input type="text" id="name" name="name" required="required" class="form-control"> </div>
74+
<input type="text" id="name" name="name" required="required" class="form-control" /> </div>
7575
HTML
7676
, trim($this->renderWidget($view)));
7777
}

Tests/Extension/FormExtensionBootstrap4LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testMoneyWidgetInIso()
7676
$this->assertSame(<<<'HTML'
7777
<div class="input-group "><div class="input-group-prepend">
7878
<span class="input-group-text">&euro; </span>
79-
</div><input type="text" id="name" name="name" required="required" class="form-control"></div>
79+
</div><input type="text" id="name" name="name" required="required" class="form-control" /></div>
8080
HTML
8181
, trim($this->renderWidget($view)));
8282
}

Tests/Extension/FormExtensionBootstrap5LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testMoneyWidgetInIso()
7575
->createView();
7676

7777
self::assertSame(<<<'HTML'
78-
<div class="input-group "><span class="input-group-text">&euro; </span><input type="text" id="name" name="name" required="required" class="form-control"></div>
78+
<div class="input-group "><span class="input-group-text">&euro; </span><input type="text" id="name" name="name" required="required" class="form-control" /></div>
7979
HTML
8080
, trim($this->renderWidget($view)));
8181
}

Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testMoneyWidgetInIso()
156156
->createView()
157157
;
158158

159-
$this->assertSame('&euro; <input type="text" id="name" name="name" required="required">', $this->renderWidget($view));
159+
$this->assertSame('&euro; <input type="text" id="name" name="name" required="required" />', $this->renderWidget($view));
160160
}
161161

162162
public function testHelpAttr()

0 commit comments

Comments
 (0)