var $ = function(selector) { alert(this === window); if(this === window) return new $(selector); } $('bla');