javascript圍觀IE10中window物件的結構

技術小胖子發表於2017-11-07

我在<<javascript遍歷DOM結構和物件結構>>一文中提供了一個遍歷物件結構的函式,利用這個函式,展現IE10中window物件的結構(還真是不少啊~除錯程式碼也在呢~)如下:

除錯資訊: 

    

    [Object] window

        |–[function] addEventListener = function addEventListener() { [native code] } 

        |–[function] alert = function alert() { [native code] } 

        |–[number] animationStartTime = 7011862239376.545

        |–[object] applicationCache

        |–[function] atob = function atob() { [native code] } 

        |–[function] attachEvent = function attachEvent() { [native code] } 

        |–[function] blur = function blur() { [native code] } 

        |–[function] btoa = function btoa() { [native code] } 

        |–[function] cancelAnimationFrame = function cancelAnimationFrame() { [native code] } 

        |–[function] clearDbgInfo = function clearDbgInfo(){ document.getElementById(“dbg”).innerHTML=””; }

        |–[function] clearImmediate = function clearImmediate() { [native code] } 

        |–[function] clearInterval = function clearInterval() { [native code] } 

        |–[function] clearTimeout = function clearTimeout() { [native code] } 

        |–[object] clientInformation

        |–[object] clipboardData

        |–[function] close = function close() { [native code] } 

        |–[boolean] closed = false

        |–[function] confirm = function confirm() { [native code] } 

        |–[object] console

        |–[function] createPopup = function createPopup() { [native code] } 

        |–[string] defaultStatus = 

        |–[function] detachEvent = function detachEvent() { [native code] } 

        |–[function] dispatchEvent = function dispatchEvent() { [native code] } 

        |–[object] document

        |–[object] event

        |–[function] execScript = function execScript() { [native code] } 

        |–[object] external

        |–[function] focus = function focus() { [native code] } 

        |–[object] frameElement

        |–[object] frames

        |–[function] getComputedStyle = function getComputedStyle() { [native code] } 

        |–[function] getSelection = function getSelection() { [native code] } 

        |–[object] history

        |–[undefined] indexedDB = undefined

        |–[number] innerHeight = 519

        |–[number] innerWidth = 1143

        |–[function] item = function item() { [native code] } 

        |–[number] length = 0

        |–[undefined] localStorage = undefined

        |–[object] location

        |–[function] matchMedia = function matchMedia() { [native code] } 

        |–[number] maxConnectionsPerServer = 10

        |–[function] moveBy = function moveBy() { [native code] } 

        |–[function] moveTo = function moveTo() { [native code] } 

        |–[number] msAnimationStartTime = 7011862239376.545

        |–[function] msCancelRequestAnimationFrame = function msCancelRequestAnimationFrame() { [native code] } 

        |–[function] msClearImmediate = function msClearImmediate() { [native code] } 

        |–[undefined] msIndexedDB = undefined

        |–[function] msIsStaticHTML = function msIsStaticHTML() { [native code] } 

        |–[function] msMatchMedia = function msMatchMedia() { [native code] } 

        |–[function] msRequestAnimationFrame = function msRequestAnimationFrame() { [native code] } 

        |–[function] msSetImmediate = function msSetImmediate() { [native code] } 

        |–[function] msWriteProfilerMark = function msWriteProfilerMark() { [native code] } 

        |–[string] name = 

        |–[function] navigate = function navigate() { [native code] } 

        |–[object] navigator

        |–[string] offscreenBuffering = auto

        |–[object] onabort

        |–[object] onafterprint

        |–[object] onbeforeprint

        |–[object] onbeforeunload

        |–[object] onblur

        |–[object] oncanplay

        |–[object] oncanplaythrough

        |–[object] onchange

        |–[object] onclick

        |–[object] oncontextmenu

        |–[object] ondblclick

        |–[object] ondrag

        |–[object] ondragend

        |–[object] ondragenter

        |–[object] ondragleave

        |–[object] ondragover

        |–[object] ondragstart

        |–[object] ondrop

        |–[object] ondurationchange

        |–[object] onemptied

        |–[object] onended

        |–[object] onerror

        |–[object] onfocus

        |–[object] onfocusin

        |–[object] onfocusout

        |–[object] onhashchange

        |–[object] onhelp

        |–[object] oninput

        |–[object] onkeydown

        |–[object] onkeypress

        |–[object] onkeyup

        |–[object] onload

        |–[object] onloadeddata

        |–[object] onloadedmetadata

        |–[object] onloadstart

        |–[object] onmessage

        |–[object] onmousedown

        |–[object] onmouseenter

        |–[object] onmouseleave

        |–[object] onmousemove

        |–[object] onmouseout

        |–[object] onmouseover

        |–[object] onmouseup

        |–[object] onmousewheel

        |–[object] onmsgesturechange

        |–[object] onmsgesturedoubletap

        |–[object] onmsgestureend

        |–[object] onmsgesturehold

        |–[object] onmsgesturestart

        |–[object] onmsgesturetap

        |–[object] onmsinertiastart

        |–[object] onmspointercancel

        |–[object] onmspointerdown

        |–[object] onmspointerhover

        |–[object] onmspointermove

        |–[object] onmspointerout

        |–[object] onmspointerover

        |–[object] onmspointerup

        |–[object] onoffline

        |–[object] ononline

        |–[object] onpause

        |–[object] onplay

        |–[object] onplaying

        |–[object] onpopstate

        |–[object] onprogress

        |–[object] onratechange

        |–[object] onreadystatechange

        |–[object] onreset

        |–[object] onresize

        |–[object] onscroll

        |–[object] onseeked

        |–[object] onseeking

        |–[object] onselect

        |–[object] onstalled

        |–[object] onstorage

        |–[object] onsubmit

        |–[object] onsuspend

        |–[object] ontimeupdate

        |–[object] onunload

        |–[object] onvolumechange

        |–[object] onwaiting

        |–[function] open = function open() { [native code] } 

        |–[undefined] opener = undefined

        |–[number] outerHeight = 617

        |–[number] outerWidth = 1149

        |–[number] pageXOffset = 0

        |–[number] pageYOffset = 0

        |–[object] parent

        |–[object] performance

        |–[function] postMessage = function postMessage() { [native code] } 

        |–[function] print = function print() { [native code] } 

        |–[function] prompt = function prompt() { [native code] } 

        |–[function] pt = function pt(myExp){ document.getElementById(“dbg”).innerHTML+=”

    “+myExp+”    “+eval(myExp)+””; }

        |–[function] put = function put(myStr){ document.getElementById(“dbg”).innerHTML+=”

    “+myStr+””; }

        |–[function] removeEventListener = function removeEventListener() { [native code] } 

        |–[function] requestAnimationFrame = function requestAnimationFrame() { [native code] } 

        |–[function] resizeBy = function resizeBy() { [native code] } 

        |–[function] resizeTo = function resizeTo() { [native code] } 

        |–[object] screen

        |–[number] screenLeft = 0

        |–[number] screenTop = 79

        |–[number] screenX = -3

        |–[number] screenY = -3

        |–[function] scroll = function scroll() { [native code] } 

        |–[function] scrollBy = function scrollBy() { [native code] } 

        |–[function] scrollTo = function scrollTo() { [native code] } 

        |–[object] self

        |–[undefined] sessionStorage = undefined

        |–[function] setImmediate = function setImmediate() { [native code] } 

        |–[function] setInterval = function setInterval() { [native code] } 

        |–[function] setTimeout = function setTimeout() { [native code] } 

        |–[function] showHelp = function showHelp() { [native code] } 

        |–[function] showModalDialog = function showModalDialog() { [native code] } 

        |–[function] showModelessDialog = function showModelessDialog() { [native code] } 

        |–[function] showObject = function showObject(myObjectName){ var myObject = eval(myObjectName); var objArray = new Array(); // 儲存物件成員名稱 var typename = null; //儲存物件成員型別 try { // 將物件成員放入陣列 for(var tmpObj in myObject) { if((myObject.hasOwnProperty && myObject.hasOwnProperty(tmpObj))||!(tmpObj===”undefined”)){ objArray[objArray.length++] = tmpObj; } } put(“”);//輸出,美化 put(“[Object] “+myObjectName+””);//輸出 if(objArray.length===0) { put(“物件沒有成員”);//輸出 return; } //對陣列進行排序 objArray.sort(); for(var k=0;k”+objArray[k]+””);//輸出 } else { put(”    |–[“+typename+”] “+objArray[k]+” = “+myObject[objArray[k]]);//輸出 } } } catch (e) { alert(“輸入的不是物件”); } }

        |–[string] status = 

        |–[object] styleMedia

        |–[function] toStaticHTML = function toStaticHTML() { [native code] } 

        |–[function] toString = function toString() { [native code] } 

        |–[object] top

        |–[object] window  

 本文轉自 hexiaini235 51CTO部落格,原文連結:http://blog.51cto.com/idata/1103417,如需轉載請自行聯絡原作者


相關文章