siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
77 lines (60 loc) • 2.63 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
*/
Class('Ariadne.DomQueryFinder.Identifier.Id', {
isa : Ariadne.QueryFinder.Identifier,
does : Ariadne.DomQueryFinder.Role.DomHelper,
has : {
uniqueDomNodeProperty : null,
shouldIgnoreDomElementId : null
},
methods : {
identify : function (target, root, maze) {
var idProperty = this.uniqueDomNodeProperty || 'id'
var id = target.getAttribute(idProperty)
var shouldIgnoreDomElementId = this.shouldIgnoreDomElementId
if (id && !this.ignoreDomId(id, target) && (!shouldIgnoreDomElementId || !shouldIgnoreDomElementId(id, target))) {
// the 1st encountered id will be assigned with weight -100000 in case of `enableMandatoryId`
// it should be guaranteed that this id will belong to lowest parent with id (currently this holds)
var weight = maze.encounteredMandatoryId || !this.finder.enableMandatoryId ? 1000 : -100000
maze.encounteredMandatoryId = true
var query = idProperty == 'id' ?
'#' + this.escapeDomSelector(id, true)
:
"[" + idProperty + "='" + this.escapeDomSelector(id) + "']"
return {
query : query,
weight : weight,
isId : true
}
} else
return null
},
ignoreDomId : function () {
return false
}
}
});
</pre>
</body>
</html>