Javascript native sort method code

Take a look at the WebKit implementation: https://gist.github.com/964673. Apparently, it uses min sort/selection sort. From: http://svn.webkit.org/repository/webkit/trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp SpiderMonkey seems to indeed use MergeSort. See: http://hg.mozilla.org/mozilla-central/file/28be8df0deb7/js/src/jsarray.cpp.

Making a short alias for document.querySelectorAll

This seems to work: const queryAll = document.querySelectorAll.bind(document); bind returns a new function which works identically to the querySelectorAll function, where the value of this inside the querySelectorAll method is bound to the document object. The bind function is only supported in IE9+ (and all the other browsers) – https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind Update: In fact you could … Read more