jenkins-bot has submitted this change and it was merged.
Change subject: redlinks: Move contents instead of serialising/reparsing html
......................................................................
redlinks: Move contents instead of serialising/reparsing html
Follows-up b0ca6a299f.
No need to serialise the node to html, then parse it again, and
destroy the original. If there were reason to re-create the
contents, a clone() would be more appropiate, but even that's
not needed here. We can just move the contents directly.
Also:
* Fix invalid html in '<span class="new">'.
* Use replace instead of insert/remove to avoid extra reflows.
(Mobile performance.) Previously it forced two reflows. One
to render the elements next to each other, one to remove the
first element. Now it will actually not reflow at all in most
cases (not even once) as the width of the text is the same
regardless of color (it merely changes from red to black).
Change-Id: I9d850fba0ecb7498d684c4416f873f31556ab229
---
M javascripts/modules/redlinks/init.js
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/modules/redlinks/init.js
b/javascripts/modules/redlinks/init.js
index 9d42f25..1e51e35 100644
--- a/javascripts/modules/redlinks/init.js
+++ b/javascripts/modules/redlinks/init.js
@@ -3,9 +3,9 @@
if ( !mw.config.get( 'wgMFShowRedLinks' ) ) {
$( function () {
$( '#content a.new' ).each( function () {
- // Use html since links might contain sup or
sub elements
- $( '<span class="new">' ).html( $( this
).html() ).insertAfter( this );
- $( this ).remove();
+ $( this ).replaceWith(
+ $( '<span class="new"></span>'
).append( $( this ).contents() )
+ );
} );
} );
}
--
To view, visit https://gerrit.wikimedia.org/r/176873
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9d850fba0ecb7498d684c4416f873f31556ab229
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits