搜索附加到全局JS对象的对象
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搜索附加到全局JS对象的对象相关的知识,希望对你有一定的参考价值。
Simple recursive function to find objects that match the value of str hanging anywhere off the global JS object (window).
function findInDOM(str, root, tree) { if(!root) root = window; if(root.length<1) return; for(var i in root) { if(i.indexOf(str) != -1) console.log((tree || "window") + "." + i); if('[object Object]' === Object.prototype.toString.apply(root[i])) findInDOM(str, root[i], (tree || "window") + "." + i); } } findInDOM("get");
以上是关于搜索附加到全局JS对象的对象的主要内容,如果未能解决你的问题,请参考以下文章