summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2011-07-04 22:55:51 +0200
committerAndreas Gohr <andi@splitbrain.org>2011-07-04 22:55:51 +0200
commit5566338d2cd5117586de2c881cffe4bc00f61a5a (patch)
treeba386d82b9ae823ae298b5d81215d9e5abdbb7d5
parent0589eb71f959c92226f31a408aefc1ca4306b54d (diff)
downloadrpg-5566338d2cd5117586de2c881cffe4bc00f61a5a.tar.gz
rpg-5566338d2cd5117586de2c881cffe4bc00f61a5a.tar.bz2
deprecated getElementsByClass
-rw-r--r--lib/scripts/compatibility.js5
-rw-r--r--lib/scripts/script.js23
2 files changed, 5 insertions, 23 deletions
diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js
index bd5403f0d..58efc03b9 100644
--- a/lib/scripts/compatibility.js
+++ b/lib/scripts/compatibility.js
@@ -23,3 +23,8 @@ function findPosY(object){
return jQuery(object).position().top;
}
+function getElementsByClass(searchClass,node,tag){
+ DEPRECATED('Use jQuery() instead');
+ if(node == null) node = document;
+ return jQuery(node).find(tag+'.'+searchClass).toArray();
+}
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 68687c14e..fc8cb6096 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -100,29 +100,6 @@ function isset(varname){
}
/**
- * Select elements by their class name
- *
- * @author Dustin Diaz <dustin [at] dustindiaz [dot] com>
- * @link http://www.dustindiaz.com/getelementsbyclass/
- */
-function getElementsByClass(searchClass,node,tag) {
- var classElements = new Array();
- if ( node == null )
- node = document;
- if ( tag == null )
- tag = '*';
- var els = node.getElementsByTagName(tag);
- var elsLen = els.length;
- var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
- for (var i = 0, j = 0; i < elsLen; i++) {
- if ( pattern.test(els[i].className) ) {
- classElements[j] = els[i];
- j++;
- }
- }
- return classElements;
-}
-
* Get the computed style of a node.
*
* @link https://acidmartin.wordpress.com/2008/08/26/style-get-any-css-property-value-of-an-object/