简体   繁体   中英

document.defaultView === window circular reference?

So I read that document.defaultView in JavaScript DOM points to the window object. Doesn't this become a circular reference and crash the document?

Since I'm new to JavaScript, DOM, and Black Magic, it stumps me that things like this are valid:

console.log(window.document.defaultView === window); //true
console.log(window.document.defaultView.document.defaultView === window); //true

Any thoughts?

正如Scimonster在评论中所说:循环引用不是无效的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM