When creating a large number of DOM elements, document.createElement and friends can add a lot of bytes and ugliness. I know that I can make my own routine or use innerHTML or something else, but why not just do this:
var $c = document.createElement;
var newP = $c('p');
Firebug complains about this post:
"Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)"
It is clear that I did something that is not allowed. Why not? This allowed for other things, for example. Array.splice or Math.min.
source
share