From 5566338d2cd5117586de2c881cffe4bc00f61a5a Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Mon, 4 Jul 2011 22:55:51 +0200 Subject: [PATCH] deprecated getElementsByClass --- lib/scripts/compatibility.js | 5 +++++ lib/scripts/script.js | 23 ----------------------- 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/ -- GitLab