Microsoft Edge and Sorting with jQuery -


i have following code works fine firefox , chrome, microsoft edge (default settings) list items not sorted — left unordered. i'm using ms edge 20.10240.16384.0.

has seen problem , found solution? (id here container of ul)

$( id + ' li' ).sort(function ( a, b ) {     return parsefloat( $( ).attr( "id" ).replace( 'page', '' ) )          > parsefloat( $( b ).attr( "id" ).replace( 'page', '' ) ); }).appendto( id + ' ul' ); 

js fiddle example: https://jsfiddle.net/c1d8caa5/2/

this code leverages native array.prototype.sort method, described in section 22.1.3.24 of ecmascript standard. method accepts single comparefn argument:

if comparefn not undefined, should function accepts 2 arguments x , y , returns negative value if x < y, zero if x = y, or positive value if x > y. (emphasis added)

as such, make sure compare function returns either -1, 0, or 1. additionally, can subtract 1 number other, yield negative number, zero, or positive number, , fulfilling requirements.

while microsoft edge may not in violation of standard here, if other major browsers implement more loosely (accepting booleans), , edge not, may grounds file interop issue , see if edge should brought alignment.

i work on edge team, , file issue consideration.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -