UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

66 lines (54 loc) 2.12 kB
<!DOCTYPE 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(&#39;Ariadne.ExtJSComponentQueryFinder.TreeWalker&#39;, { methods : { getParent : function (cmp) { return cmp.getRefOwner &amp;&amp; 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 // // // &quot;comp.contains()&quot; may throw exception // // https://www.sencha.com/forum/showthread.php?331619-6-2-CQ-crash&amp;p=1164685#post1164685 // try { // return parentCmp == childCmp || parentCmp.contains &amp;&amp; parentCmp.contains(childCmp, true) || false // } catch (e) { // return false // } // the new, more robust to various glitches implementation of &quot;contains&quot; var CQ = this.Ext.ComponentQuery if (parentCmp == CQ) return true if (childCmp == CQ) return false while (childCmp &amp;&amp; childCmp != CQ) { if (childCmp == parentCmp) return true childCmp = this.getParent(childCmp) } return false } } }); </pre> </body> </html>