siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
66 lines (54 loc) • 2.12 kB
HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js">/*
Siesta 5.6.1
Copyright(c) 2009-2022 Bryntum AB
https://bryntum.com/contact
https://bryntum.com/products/siesta/license
*/
Role('Ariadne.ExtJSComponentQueryFinder.TreeWalker', {
methods : {
getParent : function (cmp) {
return cmp.getRefOwner && cmp.getRefOwner() || cmp.ownerCt || this.Ext.ComponentQuery
},
contains : function (parentCmp, childCmp) {
// if (parentCmp == this.Ext.ComponentQuery) return true
// if (childCmp == this.Ext.ComponentQuery) return false
//
// // "comp.contains()" may throw exception
// // https://www.sencha.com/forum/showthread.php?331619-6-2-CQ-crash&p=1164685#post1164685
// try {
// return parentCmp == childCmp || parentCmp.contains && parentCmp.contains(childCmp, true) || false
// } catch (e) {
// return false
// }
// the new, more robust to various glitches implementation of "contains"
var CQ = this.Ext.ComponentQuery
if (parentCmp == CQ) return true
if (childCmp == CQ) return false
while (childCmp && childCmp != CQ) {
if (childCmp == parentCmp) return true
childCmp = this.getParent(childCmp)
}
return false
}
}
});
</pre>
</body>
</html>