[Jifty-commit] r4722 - in jifty/trunk: share/web/static/js/cssquery

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Dec 17 06:57:38 EST 2007


Author: sartak
Date: Mon Dec 17 06:57:35 2007
New Revision: 4722

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/share/web/static/js/cssquery/cssQuery.js

Log:
 r49139 at onn:  sartak | 2007-12-17 06:55:58 -0500
 Revert 4650 (cssquery change) because ".error is no longer hidden for the region being replaced with ajax" in some browsers


Modified: jifty/trunk/share/web/static/js/cssquery/cssQuery.js
==============================================================================
--- jifty/trunk/share/web/static/js/cssquery/cssQuery.js	(original)
+++ jifty/trunk/share/web/static/js/cssquery/cssQuery.js	Mon Dec 17 06:57:35 2007
@@ -5,9 +5,6 @@
 
 	Modifed by Nelson Elhage <nelhage at bestpractical.com>
 	(2006-06-21) to optimize selection by ID on non-IE browsers
-
-    Modified by Shawn M Moore <sartak at bestpractical.com>
-    (2007-12-07) sped up thisElement, descendent selector, and class selector
 */
 
 // the following functions allow querying of the DOM using CSS selectors
@@ -165,14 +162,12 @@
 
 // class selector
 selectors["."] = function($results, $from, $className) {
-    $className = " " + $className + " ";
-    var $element, i;
-    for (i = 0; ($element = $from[i]); i++) {
-        var classes = " " + $element.className + " ";
-        if (classes.indexOf($className) > -1) {
-            $results.push($element);
-        }
-    }
+	// create a RegExp version of the class
+	$className = new RegExp("(^|\\s)" + $className + "(\\s|$)");
+	// loop through current selection and check class
+	var $element, i;
+	for (i = 0; ($element = $from[i]); i++)
+		if ($className.test($element.className)) $results.push($element);
 };
 
 // pseudo-class selector


More information about the Jifty-commit mailing list