Is it too lame to write like this?
var html = $('html');
Seems that html
is equal to $(window)
or $(document)
?
How can it be replaced by a crossbrowser native javascript?
The top-level element (html
in the case of HTML documents) is available as document.documentElement
(references: spec | MDN).
And of course, if you want to use jQuery stuff on it, get a jQuery wrapper: $(document.documentElement)
.
In terms of cross-browser support, I'd be fairly shocked if you found anything even vaguely recent that didn't support it (and that includes IE6), it was actually in DOM1, which was a long time ago. See this related question on that very topic.