Skip to content

Commit c74a439

Browse files
authored
Fix: Append all posts from IS response (#15368)
1 parent 07162c6 commit c74a439

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/infinite-scroll/infinity.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,13 @@
151151
* Renders the results from a successful response.
152152
*/
153153
Scroller.prototype.render = function( response ) {
154+
var childrenToAppend = Array.prototype.slice.call( response.fragment.childNodes );
154155
this.body.classList.add( 'infinity-success' );
155156

156157
// Render the retrieved nodes.
157-
for ( var i = 0; i < response.fragment.childNodes.length; i++ ) {
158-
this.element.appendChild( response.fragment.childNodes[ i ] );
158+
while ( childrenToAppend.length > 0 ) {
159+
var currentNode = childrenToAppend.shift();
160+
this.element.appendChild( currentNode );
159161
}
160162

161163
this.trigger( this.body, 'is.post-load', {

0 commit comments

Comments
 (0)