3 ms·
Though the alert may look nice, the actual JS behind it is hugely wanting for several reasons: - 690 LOC to produce an alert dialog - Heavy use of Javascript
by tshadwell 12y ago
Though the alert may look nice, the actual JS behind it is hugely wanting for several reasons:
- 690 LOC to produce an alert dialog
- Heavy use of Javascript for what CSS is designed for: https://github.com/t4t5/sweetalert/blob/master/lib/sweet-alert.js#L258-L303 https://github.com/t4t5/sweetalert/blob/master/lib/sweet-ale...
- Inconsistent between function spacing followed by mixed tabs and spaces
- Odd use of DOM based attributes to pass configuration options
- Colourspace manipulation on each call where SASS would be effective
https://github.com/t4t5/sweetalert/blob/master/lib/sweet-alert.js#L566 https://github.com/t4t5/sweetalert/blob/master/lib/sweet-ale...
- Includes jquery, but uses it very little, instead opting to re-invent the wheel in most cases.
- Strange click event firing, gratuitous use of magic key code numbers https://github.com/t4t5/sweetalert/blob/master/lib/sweet-alert.js#L391 https://github.com/t4t5/sweetalert/blob/master/lib/sweet-ale...
etc...