Merge "Don't armor french spaces before punctuation followed by word characters"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 13 Jul 2018 17:22:34 +0000 (17:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 13 Jul 2018 17:22:34 +0000 (17:22 +0000)
1  2 
includes/parser/Sanitizer.php
tests/parser/parserTests.txt

@@@ -463,12 -463,12 +463,12 @@@ class Sanitizer 
         * Cleans up HTML, removes dangerous tags and attributes, and
         * removes HTML comments
         * @param string $text
 -       * @param callable $processCallback Callback to do any variable or parameter
 +       * @param callable|null $processCallback Callback to do any variable or parameter
         *   replacements in HTML attribute values
         * @param array|bool $args Arguments for the processing callback
         * @param array $extratags For any extra tags to include
         * @param array $removetags For any tags (default or extra) to exclude
 -       * @param callable $warnCallback (Deprecated) Callback allowing the
 +       * @param callable|null $warnCallback (Deprecated) Callback allowing the
         *   addition of a tracking category when bad input is encountered.
         *   DO NOT ADD NEW PARAMETERS AFTER $warnCallback, since it will be
         *   removed shortly.
                $fixtags = [
                        # French spaces, last one Guillemet-left
                        # only if there is something before the space
-                       '/(.) (?=[?:;!%»])/u' => "\\1$space",
+                       # and a non-word character after the punctuation.
+                       '/(\S) (?=[?:;!%»›](?!\w))/u' => "\\1$space",
                        # French spaces, Guillemet-right
-                       '/(«) /u' => "\\1$space",
+                       '/([«‹]) /u' => "\\1$space",
                ];
                return preg_replace( array_keys( $fixtags ), array_values( $fixtags ), $text );
        }
  <link rel="mw:PageProp/Category" href="./Category:Ho" />
  !! end
  
 +!! test
 +Paragraph wrapping following unclosed table
 +!! options
 +parsoid=wt2html,html2html
 +!! wikitext
 +{|
 +|-
 +
 +{|
 +| x
 +|}
 +
 +a
 +
 +b
 +
 +c
 +!! html/php+tidy
 +<table>
 +
 +
 +</table><table>
 +<tbody><tr>
 +<td>x
 +</td></tr></tbody></table>
 +<p>a
 +</p><p>b
 +</p><p>c
 +</p>
 +!! html/parsoid
 +<table data-parsoid='{"autoInsertedEnd":true}'>
 +<tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
 +
 +</tbody></table><table>
 +<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
 +</tbody></table>
 +
 +<p>a</p>
 +
 +<p>b</p>
 +
 +<p>c</p>
 +!! end
 +
 +!! test
 +Paragraph wrapping suppressed in html p
 +!! options
 +parsoid=wt2html,html2html
 +!! wikitext
 +<p>
 +
 +
 +hi
 +
 +
 +
 +</p>
 +!! html/php+tidy
 +<p>
 +
 +
 +hi
 +
 +
 +
 +</p>
 +!! html/parsoid
 +<p data-parsoid='{"stx":"html"}'>
 +
 +
 +hi
 +
 +
 +
 +</p>
 +!! end
 +
  ###
  ### Preformatted text
  ###
@@@ -2496,11 -2419,6 +2496,11 @@@ Foo <del>bar</del> <ins>baz</ins> quu
  </p>
  </blockquote>
  
 +!! html+tidy
 +<blockquote>
 +<p>Foo <del>bar</del> <ins>baz</ins> quux
 +</p>
 +</blockquote>
  !! end
  
  !! test
@@@ -2513,7 -2431,7 +2513,7 @@@ T17491: <ins>/<del> in blockquote (2
  </blockquote>
  
  !! html+tidy
 -<blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
 +<blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
  </p></blockquote>
  !! end
  
@@@ -3962,7 -3880,7 +3962,7 @@@ Simple definitio
  !! wikitext
  ;name :Definition
  !! html
- <dl><dt>name&#160;</dt>
+ <dl><dt>name</dt>
  <dd>Definition</dd></dl>
  
  !! end
@@@ -3991,7 -3909,7 +3991,7 @@@ Definition list with URL lin
  !! wikitext
  ;http://example.com/ :definition
  !! html
- <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
+ <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
  <dd>definition</dd></dl>
  
  !! end
@@@ -4022,7 -3940,7 +4022,7 @@@ Definition list with news link containi
  !! wikitext
  ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
  !! html/php
- <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a>&#160;</dt>
+ <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
  <dd>This isn't even a real newsgroup!</dd></dl>
  
  !! html/parsoid
@@@ -4043,7 -3961,7 +4043,7 @@@ Definition lists: colon in external lin
  !! wikitext
  ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
  !! html
- <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
+ <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
  <dd>OK, I made that up</dd></dl>
  
  !! end
@@@ -4062,7 -3980,7 +4062,7 @@@ Definition lists: self-closed ta
  !! wikitext
  ;one<br/>two :two-line fun
  !! html
- <dl><dt>one<br />two&#160;</dt>
+ <dl><dt>one<br />two</dt>
  <dd>two-line fun</dd></dl>
  
  !! end
@@@ -4082,7 -4000,7 +4082,7 @@@ Definition lists: excess closed tag
  !! wikitext
  ;one</b>two :bad tag fun
  !! html/php+tidy
- <dl><dt>onetwo&#160;</dt>
+ <dl><dt>onetwo</dt>
  <dd>bad tag fun</dd></dl>
  !! html/parsoid
  <dl>
@@@ -4119,7 -4037,7 +4119,7 @@@ Definition and unordered list using wik
  </li></ul>
  !! html
  <ul><li>
- <dl><dt>term&#160;</dt>
+ <dl><dt>term</dt>
  <dd>description</dd></dl>
  <ul><li>unordered</li></ul>
  </li></ul>
@@@ -4519,9 -4437,9 +4519,9 @@@ Definition Lists: Mixed Lists: Test 
  *;d1 :d2
  *;d3 :d4
  !! html
- <ul><li><dl><dt>d1&#160;</dt>
+ <ul><li><dl><dt>d1</dt>
  <dd>d2</dd>
- <dt>d3&#160;</dt>
+ <dt>d3</dt>
  <dd>d4</dd></dl></li></ul>
  
  !! end
@@@ -4580,7 -4498,7 +4580,7 @@@ Definition Lists: Mixed Lists: Test 
  !! wikitext
  *;foo :bar
  !! html
- <ul><li><dl><dt>foo&#160;</dt>
+ <ul><li><dl><dt>foo</dt>
  <dd>bar</dd></dl></li></ul>
  
  !! end
@@@ -4591,7 -4509,7 +4591,7 @@@ Definition Lists: Mixed Lists: Test 1
  !! wikitext
  *#;foo :bar
  !! html
- <ul><li><ol><li><dl><dt>foo&#160;</dt>
+ <ul><li><ol><li><dl><dt>foo</dt>
  <dd>bar</dd></dl></li></ol></li></ul>
  
  !! end
@@@ -4624,15 -4542,15 +4624,15 @@@ Definition Lists: Mixed Lists: Test 1
  *#*#;*;;foo :bar
  *#*#;boo :baz
  !! html/php
- <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
+ <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
  <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
- <dl><dt>boo&#160;</dt>
+ <dl><dt>boo</dt>
  <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
  
  !! html/php+tidy
- <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
+ <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
  <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
- <dl><dt>boo&#160;</dt>
+ <dl><dt>boo</dt>
  <dd>baz</dd></dl></li></ol></li></ul>
  !! html/parsoid
  <ul>
  <dl>
  <dt>
  <dl>
- <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
+ <dt>foo</dt>
  <dd data-parsoid='{"stx":"row"}'>bar</dd>
  </dl></dt>
  </dl></li>
  </ul></dt>
- <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
+ <dt>boo</dt>
  <dd data-parsoid='{"stx":"row"}'>baz</dd>
  </dl></li>
  </ol></li>
  </ul>
  !! end
  
+ !! test
+ Definition Lists: Mixed Lists: Test 13
+ !! wikitext
+ *#*#;*;;foo : bar
+ *#*#;boo : baz
+ !! html+tidy
+ <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
+ <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
+ <dl><dt>boo&#160;</dt>
+ <dd>baz</dd></dl></li></ol></li></ul>
+ !! end
  # FIXME: Maybe get rid of this test?
  # From whitelist:
  # * The test is wrong, there are two colons where there should be :;
@@@ -4673,7 -4603,7 +4685,7 @@@ Definition Lists: Weird Ones: Test 
  !! wikitext
  *#;*::;;foo :bar (who uses this?)
  !! html/php+tidy
- <ul><li><ol><li><dl><dt>foo&#160;</dt>
+ <ul><li><ol><li><dl><dt>foo</dt>
  <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
  !! html/parsoid
  <ul>
  <dl>
  <dt>
  <dl>
- <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
+ <dt>foo</dt>
  <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
  </dl></dt>
  </dl></dd>
@@@ -6798,7 -6728,7 +6810,7 @@@ Element attributes with double ! shoul
  !! html/php
  <table>
  <tr>
- <td><div style="color: red&#32;!important;" data-contrived="put this here &#124;&#124;">hi</div>
+ <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
  </td></tr></table>
  
  !! html/parsoid
@@@ -6819,7 -6749,7 +6831,7 @@@ parsoid=wt2htm
  !! html/php
  <table>
  <tr>
- <td>style="color: red&#160;!important;" data-contrived="put this here</td>
+ <td>style="color: red !important;" data-contrived="put this here</td>
  <td>foo
  </td></tr></table>
  
  a
  <table></table>
  !! html/parsoid
 -<p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
 -<tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
 -
 -</tr></tbody></table>
 +<span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
 +a
 +</span><table>
 +<tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
  !! end
  
  !! test
@@@ -9932,7 -9862,7 +9944,7 @@@ List interrupted by empty line or headi
  
  !!end
  
 -!!test
 +!! test
  Multiple list tags generated by templates
  !! wikitext
  {{echo|<li>}}a
  </li>
  </li>
  
 +
  !! html+tidy
  <li>a
  </li><li>b
  <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
  </li><li about="#mwt1">b
  </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
 -!!end
 +!! end
 +
 +!! test
 +Multiple newlines in between HTML list items don't induce paragraph wrapping
 +!! wikitext
 +<ul>
 +<li>hi</li>
 +
 +
 +
 +
 +<li>ho</li>
 +</ul>
 +
 +<dl>
 +<dt>hi</dt>
 +<dd>ho<div>123</div>
 +</dd>
 +
 +
 +</dl>
 +!! html/php+tidy
 +<ul>
 +<li>hi</li>
 +
 +
 +
 +
 +<li>ho</li>
 +</ul>
 +<dl>
 +<dt>hi</dt>
 +<dd>ho<div>123</div>
 +</dd>
 +
 +
 +</dl>
 +!! end
  
  !!test
  Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
@@@ -12906,23 -12798,16 +12918,23 @@@ Templates: Block Tags: 2. Back-to-back 
  
  !!end
  
 -# This is an edge case relating to paragraph wrapping.
 -!!test
 +## This is an edge case relating to paragraph wrapping.
 +## Note that Parsoid fails to match Remex because it's using the closing tag
 +## as a heuristic to determine if it's in a block, rather than SAX based events.
 +## And Parsoid drops empty elements in templates.
 +!! test
  Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
  !! wikitext
  {{echo|a
  b</p>}}
 +!! html/php+tidy
 +<p>a
 +</p><p>
 +b</p><p class="mw-empty-elt"></p>
  !! html/parsoid
 -<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
 -b</p>
 -!!end
 +<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a</p><span about="#mwt1">
 +</span><span about="#mwt1">b</span>
 +!! end
  
  !!test
  Templates: Links: 1. Simple example
@@@ -13291,13 -13176,13 +13303,13 @@@ parsoid=wt2html,wt2w
  <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
  !!end
  
 -!!test
 +!! test
  Templates: Wiki Tables: 1a. Fostering of entire template content
  !! wikitext
  {|
  {{echo|a}}
  |}
 -!! html
 +!! html/php
  <table>
  a
  <tr><td></td></tr></table>
  a
  <table><tbody><tr><td></td></tr></tbody></table>
  !! html/parsoid
 -<p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
 +<span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</span><table about="#mwt2">
  
  </table>
  !! end
  </table>
  !! end
  
 -!!test
 +!! test
  Templates: Wiki Tables: 2. Fostering of partial template content
  !! wikitext
  {|
  {{echo|a
  <div>b</div>}}
  |}
 -!! html
 +!! html/php
  <table>
  a
  <div>b</div>
  <div>b</div><table>
  <tbody><tr><td></td></tr></tbody></table>
  !! html/parsoid
 -<p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
 +<span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</span><div about="#mwt2">b</div><table about="#mwt2">
  
  
  </table>
@@@ -16654,7 -16539,7 +16666,7 @@@ Section headings with TO
  Some text
  ===Another headline===
  !! html
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
  <ul>
@@@ -16697,7 -16582,7 +16709,7 @@@ __FORCETOC_
  ==Headline 2==
  ==Headline==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
@@@ -16731,7 -16616,7 +16743,7 @@@ parsoid=wt2htm
  =========Level 9 Heading=========
  ==========Level 10 Heading==========
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
  <ul>
@@@ -16795,7 -16680,7 +16807,7 @@@ TOC regression (T11764
  ==title 2==
  ===title 2.1===
  !! html
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  <ul>
@@@ -16830,7 -16715,7 +16842,7 @@@ TOC for heading containing <span id="..
  __FORCETOC__
  ==<span id="old-anchor"></span>New title==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
  </ul>
@@@ -16852,7 -16737,7 +16864,7 @@@ wgMaxTocLevel=
  ==title 2==
  ===title 2.1===
  !! html
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  <ul>
@@@ -16888,7 -16773,7 +16900,7 @@@ wgMaxTocLevel=
  ====Section 1.1.1.1====
  ==Section 2==
  !! html
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
  <ul>
@@@ -16981,7 -16866,7 +16993,7 @@@ __TOC_
  ===title 1.1===
  ==title 2==
  !! html
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  <ul>
@@@ -17057,7 -16942,7 +17069,7 @@@ section 
  !! html/php
  <p>The tooltips shall not show entities to the user (ie. be double escaped)
  </p>
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
@@@ -17133,7 -17018,7 +17145,7 @@@ section 
  !! html/php
  <p>Id should not contain + for spaces
  </p>
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
@@@ -17209,7 -17094,7 +17221,7 @@@ parsoid=wt2html,wt2wt,html2htm
  =''italic'' heading==
  ==''italic'' heading=
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
@@@ -17244,7 -17129,7 +17256,7 @@@ HTML headers vs TOC (T25393
  ==Header 2.2==
  __NOEDITSECTION__
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
  <ul>
@@@ -18885,7 -18770,7 +18897,7 @@@ Punctuation: CSS !important (T13874
  !! wikitext
  <div style="width:50% !important">important</div>
  !! html
- <div style="width:50%&#32;!important">important</div>
+ <div style="width:50% !important">important</div>
  
  !!end
  
@@@ -19170,7 -19055,7 +19182,7 @@@ Fuzz testing: Parser1
  http://__TOC__
  !! html/php
  <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 -http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +http://<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
  </ul>
  
  !! html/php+tidy
  <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2><p>
 -http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +http://</p><div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
  </ul>
@@@ -21663,16 -21548,16 +21675,16 @@@ Definition list code coverag
  ;title :def
  ;title:def
  !! html/php
- <dl><dt>title  &#160;</dt>
+ <dl><dt>title</dt>
  <dd>def</dd>
- <dt>title&#160;</dt>
+ <dt>title</dt>
  <dd>def</dd>
  <dt>title</dt>
  <dd>def</dd></dl>
  
  !! html/parsoid
- <dl><dt>title  <span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
- <dt>title<span typeof="mw:Placeholder"> </span></dt><dd>def</dd>
+ <dl><dt>title   </dt><dd>def</dd>
+ <dt>title </dt><dd>def</dd>
  <dt>title</dt><dd>def</dd></dl>
  !! end
  
@@@ -21751,7 -21636,7 +21763,7 @@@ Out-of-order TOC heading level
  =====5=====
  ==2==
  !! html
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
  <ul>
@@@ -22226,11 -22111,11 +22238,11 @@@ conversion
  
  ==Latinski==
  !! html/php
 -<h2><span id="-.7BNaslov.7D-"></span><span class="mw-headline" id="-{Naslov}-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
 +<h2><span id="-.7BNaslov.7D-"></span><span class="mw-headline" id="-{Naslov}-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
  <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
  цонверсион:
  </p>
 -<h2><span class="mw-headline" id="Latinski">Латински</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Уреди одељак „Латински“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
 +<h2><span class="mw-headline" id="Latinski">Латински</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Уредите одељак „Латински“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
  
  !! html/parsoid
  <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
@@@ -22998,7 -22883,7 +23010,7 @@@ language=s
  !! wikitext
  [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
  !! html/php
 -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећај"></a></div>caption:</div></div></div>
 +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећајте"></a></div>caption:</div></div></div>
  
  !! html/parsoid
  <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"}]}'><a href="./Датотека:Foobar.jpg"><img resource="./Датотека:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"caption:"}}' data-parsoid='{"fl":["R"]}'></span></figcaption></figure>
@@@ -23542,12 -23427,7 +23554,12 @@@ Line tw
  
  !! end
  
 -# FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
 +## This is a corner case interaction between the paragraph wrapping in the
 +## php parser's BlockLevelPass and Remex.  `doBlockLevels` has a notion of
 +## some tags which close paragraphs (and thus prevent wrapping on their line),
 +## of which "div" is one, but do p-wrapping inside them.  These are referred
 +## to as "never suppressing".  Remex, for its part, doesn't traverse into
 +## "div"s to p-wrap.  Hence, we only get this partial wrapping.
  !! test
  Paragraphs inside blockquotes/divs (no extra line breaks)
  !! wikitext
@@@ -24182,7 -24062,7 +24194,7 @@@ Play a bit with r67090 and T515
  <div style="width:50%&#160;!important">&nbsp;</div>
  <div style="border : solid;">&nbsp;</div>
  !! html/php
- <div style="width:50%&#32;!important">&#160;</div>
+ <div style="width:50% !important">&#160;</div>
  <div style="width:50% !important">&#160;</div>
  <div style="width:50% !important">&#160;</div>
  <div style="border&#32;: solid;">&#160;</div>
  
  !! end
  
+ !! test
+ French spaces in wikitext
+ !! wikitext
+ foo ! bar ? bat 50 % is less than 75 %.
+ Hello : this ; is « something ‹ else › again »
+ !! html
+ <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
+ </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
+ </p>
+ !! end
+ # It would be reasonable for Parsoid and PHP to differ here.
+ # The PHP behavior is arguably a bug.
+ !! test
+ Corner case: french spaces in definition list
+ !! wikitext
+ ;foo : bar
+ !! html+tidy
+ <dl><dt>foo&#160;</dt>
+ <dd>bar</dd></dl>
+ !! end
  !! test
  T5158: Test for French spaces in attributes
  !! wikitext
@@@ -24398,7 -24301,7 +24433,7 @@@ title=[[Main Page]
  __TOC__
  ==''Lost'' episodes==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
  </ul>
@@@ -24419,7 -24322,7 +24454,7 @@@ title=[[Main Page]
  __TOC__
  =='''should be bold''' then normal text==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
  </ul>
@@@ -24440,7 -24343,7 +24475,7 @@@ title=[[Main Page]
  __TOC__
  ==Image [[Image:foobar.jpg]]==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
  </ul>
@@@ -24461,7 -24364,7 +24496,7 @@@ title=[[Main Page]
  __TOC__
  ==<blockquote>Quote</blockquote>==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
  </ul>
  <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
  !! html/php+tidy
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
  </ul>
@@@ -24494,7 -24397,7 +24529,7 @@@ __TOC_
  <small>Hanc marginis exiguitas non caperet.</small>
  QED
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_&lt;_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
  </ul>
@@@ -24519,7 -24422,7 +24554,7 @@@ __TOC_
  
  ==<i>Foo</i> <blockquote>Bar</blockquote>==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
  <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
  !! html/php+tidy
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
@@@ -24558,7 -24461,7 +24593,7 @@@ __TOC_
  
  ==<sup class="a > b">Evilbye</sup>==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
@@@ -24589,7 -24492,7 +24624,7 @@@ __TOC_
  
  ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
@@@ -24620,7 -24523,7 +24655,7 @@@ T74884: bdi element in To
  __TOC__
  ==<bdi>test</bdi>==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
  </ul>
@@@ -24639,7 -24542,7 +24674,7 @@@ T35715: s/strike element in To
  __TOC__
  ==<s>test</s> test <strike>test</strike>==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
  </ul>
@@@ -24658,7 -24561,7 +24693,7 @@@ Empty <p> tag in TOC, removed by Saniti
  __TOC__
  ==x==
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
  </ul>
@@@ -30580,7 -30483,7 +30615,7 @@@ wgFragmentMode=[ 'html5', 'legacy' 
  [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
  
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
@@@ -30646,7 -30549,7 +30681,7 @@@ wgFragmentMode=[ 'legacy', 'html5' 
  [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
  
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
@@@ -30694,7 -30597,7 +30729,7 @@@ wgFragmentMode=[ 'html5' 
  [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
  
  !! html/php
 -<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
 +<div id="toc" class="toc"><input type="checkbox" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
  <ul>
  <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
  <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>