From 0589eb71f959c92226f31a408aefc1ca4306b54d Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Mon, 4 Jul 2011 22:55:11 +0200
Subject: [PATCH] deprecated findPosX and findPosY

---
 lib/scripts/compatibility.js | 11 ++++++++++
 lib/scripts/script.js        | 39 ------------------------------------
 2 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js
index 54eb07632..bd5403f0d 100644
--- a/lib/scripts/compatibility.js
+++ b/lib/scripts/compatibility.js
@@ -12,3 +12,14 @@ var ajax_quicksearch = {
     clear_results: DEPRECATED_WRAP(dw_qsearch.clear_results, dw_qsearch),
     onCompletion: DEPRECATED_WRAP(dw_qsearch.onCompletion, dw_qsearch)
 };
+
+function findPosX(object){
+    DEPRECATED('Use jQuery.position() instead');
+    return jQuery(object).position().left;
+}
+
+function findPosY(object){
+    DEPRECATED('Use jQuery.position() instead');
+    return jQuery(object).position().top;
+}
+
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 8adba829c..68687c14e 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -123,45 +123,6 @@ function getElementsByClass(searchClass,node,tag) {
     return classElements;
 }
 
-/**
- * Get the X offset of the top left corner of the given object
- *
- * @link http://www.quirksmode.org/js/findpos.html
- */
-function findPosX(object){
-  var curleft = 0;
-  var obj = $(object);
-  if (obj.offsetParent){
-    do {
-      curleft += obj.offsetLeft;
-    } while (obj = obj.offsetParent);
-  }
-  else if (obj.x){
-    curleft += obj.x;
-  }
-  return curleft;
-} //end findPosX function
-
-/**
- * Get the Y offset of the top left corner of the given object
- *
- * @link http://www.quirksmode.org/js/findpos.html
- */
-function findPosY(object){
-  var curtop = 0;
-  var obj = $(object);
-  if (obj.offsetParent){
-    do {
-      curtop += obj.offsetTop;
-    } while (obj = obj.offsetParent);
-  }
-  else if (obj.y){
-    curtop += obj.y;
-  }
-  return curtop;
-} //end findPosY function
-
-/**
  * Get the computed style of a node.
  *
  * @link https://acidmartin.wordpress.com/2008/08/26/style-get-any-css-property-value-of-an-object/
-- 
GitLab