backbone-forms icon indicating copy to clipboard operation
backbone-forms copied to clipboard

Fix ensuring order of items in checkboxes and select options

Open pkatseas opened this issue 10 years ago • 4 comments

I came across an issue where the options in select elements were ordered inconsistently across browsers. It looks like jQuery's add() cannot guarantee the order of elements added, which we can ensure by using a document fragment.

pkatseas avatar Jan 26 '15 17:01 pkatseas

What browser is this an issue with ?

exussum12 avatar Jan 26 '15 17:01 exussum12

I tested it on Chrome and Firefox. Chrome was displaying select options in a seemingly random order, albeit consistent. Firefox was always displaying the options in the order expected (as specified through comparator).

pkatseas avatar Jan 26 '15 18:01 pkatseas

The commit has conflicts, Can you just update the src files, the build process will run soon after merge (and prevent the merge conflicts)

exussum12 avatar Jan 22 '16 22:01 exussum12

Would it not be better to push the items into an array, then return this - html() will take an array of elements (from jQuery 1.8 I believe) https://jsfiddle.net/glenpike/noc4Lxoo/

(It avoids chopping and changing between vanilla & jQuery based script)

glenpike avatar Jun 02 '16 23:06 glenpike