var getWindow = function(obj) { var winProp = !+"\v1" ? 'parentWindow' : 'defaultView'; return obj[winProp] || (obj.ownerDocument && obj.ownerDocument[winProp]) || obj; } var isWindow = function(obj){ return obj.document && obj.document.nodeType === 9 || obj.contentDocument && obj.contentDocument.nodeType === 9 }