mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ImageMap
synced 2024-11-30 17:04:18 +00:00
Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag
Browsers just treat the self-closed <a> tag as only the open tag, so anything after the map would become linked. tidy normally cleans this up, but other wikis without it, or those using RemexHtml would see this issue. Fix suggested by Phabricator user Porplemontage Bug: T136855 Change-Id: I3b00e1a9cbb096afebe37614a79548f64d561e3b
This commit is contained in:
parent
85568e99a9
commit
2ba1d20fcd
|
@ -353,7 +353,7 @@ class ImageMap {
|
||||||
// Output the result
|
// Output the result
|
||||||
// We use saveXML() not saveHTML() because then we get XHTML-compliant output.
|
// We use saveXML() not saveHTML() because then we get XHTML-compliant output.
|
||||||
// The disadvantage is that we have to strip out the DTD
|
// The disadvantage is that we have to strip out the DTD
|
||||||
$output = preg_replace( '/<\?xml[^?]*\?>/', '', $domDoc->saveXML() );
|
$output = preg_replace( '/<\?xml[^?]*\?>/', '', $domDoc->saveXML( null, LIBXML_NOEMPTYTAG ) );
|
||||||
|
|
||||||
// Register links
|
// Register links
|
||||||
foreach ( $links as $title ) {
|
foreach ( $links as $title ) {
|
||||||
|
|
|
@ -5,6 +5,6 @@ dummy test
|
||||||
Image:Foobar.jpg
|
Image:Foobar.jpg
|
||||||
</imagemap>
|
</imagemap>
|
||||||
!! result
|
!! result
|
||||||
<div class="noresize" style="height: 220px; width: 1941px; "><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220"/><div style="margin-left: 1921px; margin-top: -20px; text-align: left;"><a href="/wiki/File:Foobar.jpg" title="About this image"><img alt="About this image" src="/extensions/ImageMap/desc-20.png?15600" style="border: none;"/></a></div></div>
|
<div class="noresize" style="height: 220px; width: 1941px; "><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220"></img><div style="margin-left: 1921px; margin-top: -20px; text-align: left;"><a href="/wiki/File:Foobar.jpg" title="About this image"><img alt="About this image" src="/extensions/ImageMap/desc-20.png?15600" style="border: none;"></img></a></div></div>
|
||||||
|
|
||||||
!! end
|
!! end
|
||||||
|
|
Loading…
Reference in a new issue