jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/385326 )
Change subject: Use LIBXML_NOEMPTYTAG to avoid creating self-closing <a> tag
......................................................................
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
(cherry picked from commit 2ba1d20fcde046c0f8dc813d0d723c5858805ccd)
---
M ImageMap_body.php
M imageMapParserTests.txt
2 files changed, 2 insertions(+), 2 deletions(-)
Approvals:
Umherirrender: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ImageMap_body.php b/ImageMap_body.php
index 225341f..3c4e884 100644
--- a/ImageMap_body.php
+++ b/ImageMap_body.php
@@ -351,7 +351,7 @@
// Output the result
// We use saveXML() not saveHTML() because then we get
XHTML-compliant output.
// 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
foreach ( $links as $title ) {
diff --git a/imageMapParserTests.txt b/imageMapParserTests.txt
index 89ef34b..be49a28 100644
--- a/imageMapParserTests.txt
+++ b/imageMapParserTests.txt
@@ -5,6 +5,6 @@
Image:Foobar.jpg
</imagemap>
!! 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
--
To view, visit https://gerrit.wikimedia.org/r/385326
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3b00e1a9cbb096afebe37614a79548f64d561e3b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ImageMap
Gerrit-Branch: REL1_27
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits