plugins/prefixfree.jsapi.js
function dig(o, namerg) {
		var os = [],
			out;
		function digger(o, namerg, res) {
			o = o || this;
			res = res || [];
			for(var i = 0; i < res.length; i++) {
				if(o === res[i]) {
					return res;
				}
			}
			os.push(o);
			try{
				for(var name in o);
			} catch(e) {
				return [];
			}
			var inside,
				clean = true;
			for(name in o) {
				if(clean && o.hasOwnProperty(name) && name.match(namerg)) {
					res.push(o);
					clean = false;
				}
				var isObject = false;
				try{
					isObject = o[name] === Object(o[name]) && typeof o[name] != "function";
				} catch(e) {}
				if(isObject) {
					inside = false;
					for (i = 0, ii = os.length; i < ii; i++) {
						if (os[i] == o[name]) {
							inside = true;
							break;
						}
					}
					if (!inside) {
						digger(o[name], namerg, res);
					}
				}
			}
			return res;
		}
		out = digger(o, namerg);
		os = null;
		return out;
	}
function dig(o, namerg) {
		var os = [],
			out;
		function digger(o, namerg, res) {
			o = o || this;
			res = res || [];
			for(var i = 0; i < res.length; i++) {
				if(o === res[i]) {
					return res;
				}
			}
			os.push(o);
			try{
				for(var name in o);
			} catch(e) {
				return [];
			}
			var inside,
				clean = true;
			for(name in o) {
				if(clean && o.hasOwnProperty(name) && name.match(namerg)) {
					res.push(o);
					clean = false;
				}
				var isObject = false;
				try{
					isObject = o[name] === Object(o[name]) && typeof o[name] != "function";
				} catch(e) {}
				if(isObject) {
					inside = false;
					for (i = 0, ii = os.length; i < ii; i++) {
						if (os[i] == o[name]) {
							inside = true;
							break;
						}
					}
					if (!inside) {
						digger(o[name], namerg, res);
					}
				}
			}
			return res;
		}
		out = digger(o, namerg);
		os = null;
		return out;
	}
function dig ( o , namerg ) { var os = [ ] , out ; function digger ( o , namerg , res ) { o = o || this ; res = res || [ ] ; for ( var i = 0 ; i < res . length ; i ++ ) { if ( o === res [ i ] ) { return res ; } } os . push ( o ) ; try { for ( var name in o ) ; } catch ( e ) { return [ ] ; } var inside , clean = true ; for ( name in o ) { if ( clean && o . hasOwnProperty ( name ) && name . match ( namerg ) ) { res . push ( o ) ; clean = false ; } var isObject = false ; try { isObject = o [ name ] === Object ( o [ name ] ) && typeof o [ name ] != "function" ; } catch ( e ) { } if ( isObject ) { inside = false ; for ( i = 0 , ii = os . length ; i < ii ; i ++ ) { if ( os [ i ] == o [ name ] ) { inside = true ; break ; } } if ( ! inside ) { digger ( o [ name ] , namerg , res ) ; } } } return res ; } out = digger ( o , namerg ) ; os = null ; return out ; }
This function digs through the objects in order to find out which have prefixed methods and therefore, which need to be extended.
This function digs through the objects in order to find out which have prefixed methods and therefore which need to be extended .