4 ms·
I'm a little biased, but just from reading through, it looks like the original does some pretty out-of-date things. I'm annotating the copy in the new project'
by zackbloom 13y ago
I'm a little biased, but just from reading through, it looks like the original does some pretty out-of-date things. I'm annotating the copy in the new project's repo, just to allow me to link to line numbers, but this IS THE LEGACY PROJECT'S CODE:
- Webdings: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js#L103 https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...
- Using class names, rather than data attributes, for everything: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js#L111 https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...
- Hardcoded date formats which would make localization tough: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js#L32 https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...
- Sorting in JavaScript (not using Array.prototype.sort): https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js#L305 https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...
- Overriding event bindings in a destructive manner: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js#L370 https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...
Not to mention stuff I just find objectionable:
- Useless comments: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js#L27 https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...
- Mistabbing: https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js#L440 https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438...
It also looks like this one is 1/3 the length.
To be fair though, the original was written seven years ago, and still works, so it's not really fair to criticize it by modern standards. Suffice it to say that it was time for something new.