r113829 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113828‎ | r113829 | r113830 >
Date:18:29, 14 March 2012
Author:preilly
Status:ok
Tags:
Comment:
1.19wmf: MFT r113828
Modified paths:
  • /branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/ZeroRatedMobileAccess/ZeroRatedMobileAccess.body.php
@@ -283,6 +283,7 @@
284284 if ( !self::$isFilePage && self::$forceClickToViewImages ) {
285285 $tagToReplace = 'img';
286286 $tagToReplaceNodes = $doc->getElementsByTagName( $tagToReplace );
 287+ $tagToReplaceNodesCollection = array();
287288 foreach ( $tagToReplaceNodes as $tagToReplaceNode ) {
288289 if ( $tagToReplaceNode ) {
289290 $alt = $tagToReplaceNode->getAttribute( 'alt' );
@@ -291,9 +292,13 @@
292293 if ( $alt ) {
293294 $spanNode->setAttribute( 'title', $alt );
294295 }
295 - $tagToReplaceNode->parentNode->replaceChild( $spanNode, $tagToReplaceNode );
 296+ $tagToReplaceNodesCollection[] = array( 'tagToReplaceNode' => $tagToReplaceNode, 'spanNode' => $spanNode );
296297 }
297298 }
 299+
 300+ foreach ( $tagToReplaceNodesCollection as $element ) {
 301+ $element['tagToReplaceNode']->parentNode->replaceChild( $element['spanNode'], $element['tagToReplaceNode'] );
 302+ }
298303 }
299304
300305 $zeroRatedLinks = $xpath->query( "//a[not(contains(@class,'external'))]" );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113828fix for DOM elements replace after initial transversalpreilly18:28, 14 March 2012

Status & tagging log