Can a \"shortcut\" not be made to methods such as document.createElement
, document.createTextNode
, [element].setSelectionRange
etc?
There are two obvious issues:
this
value (it will be the global object rather than document
), which the DOM method may or may not depend upon;Function
object and may not therefore have the call()
or apply()
methods that you could otherwise use to provide the correct this
value.This being the case, you're better off writing a wrapper function instead, such as
function c(tagName) {
return document.createElement(tagName);
}