jenkins-bot has submitted this change and it was merged.
Change subject: Lazy-load: Avoid jQuery filter() due to pushStack() memory
......................................................................
Lazy-load: Avoid jQuery filter() due to pushStack() memory
Assigning the result of filter() is the same as chaining.
For chaining support, jQuery has to keep a stack of all previous versions of
the collections so that things like end() and addBack() work as expected.
In general, when maintaining a collection for a long time, avoid jQuery methods
and use a plain array instead. Otherwise it requires jQuery to keep hold of
all previous versions of the array.
Change-Id: I6b0f08f3f32b490110c7faf5c649effdb3818936
---
M resources/mobile.startup/Skin.js
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/mobile.startup/Skin.js b/resources/mobile.startup/Skin.js
index dc8361b..f7771c3 100644
--- a/resources/mobile.startup/Skin.js
+++ b/resources/mobile.startup/Skin.js
@@ -175,14 +175,14 @@
*/
loadImages: function () {
var self = this,
- $imagePlaceholders = this.$( '#content' ).find(
'.lazy-image-placeholder' );
+ imagePlaceholders = this.$( '#content' ).find(
'.lazy-image-placeholder' ).toArray();
/**
* Load remaining images in viewport
*/
function _loadImages() {
- $imagePlaceholders = $imagePlaceholders.filter(
function ( index, placeholder ) {
+ imagePlaceholders = $.grep( imagePlaceholders,
function ( placeholder ) {
var $placeholder = $( placeholder );
if (
@@ -196,7 +196,7 @@
return true;
} );
- if ( !$imagePlaceholders.length ) {
+ if ( !imagePlaceholders.length ) {
M.off( 'scroll', _loadImages );
M.off( 'resize', _loadImages );
M.off( 'section-toggled', _loadImages );
--
To view, visit https://gerrit.wikimedia.org/r/277430
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6b0f08f3f32b490110c7faf5c649effdb3818936
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits