MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / distance

Function distance

javascript/atoms/locators/relative.js:388–399  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

386 };
387
388 var distance = function (e) {
389 var rect = bot.dom.getClientRect(e);
390 var center = {
391 x: rect.left + (Math.max(1, rect.width) / 2),
392 y: rect.top + (Math.max(1, rect.height) / 2)
393 };
394
395 var x = Math.pow(anchorCenter.x - center.x, 2);
396 var y = Math.pow(anchorCenter.y - center.y, 2);
397
398 return Math.sqrt(x + y);
399 };
400
401 goog.array.sort(elements, function (left, right) {
402 return distance(left) - distance(right);

Callers 1

relative.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected