[Jifty-commit] r4736 - in jifty/trunk: share/web/static/js/cssquery
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Dec 18 12:45:43 EST 2007
Author: sartak
Date: Tue Dec 18 12:45:42 2007
New Revision: 4736
Modified:
jifty/trunk/ (props changed)
jifty/trunk/share/web/static/js/cssquery/cssQuery.js
Log:
r49191 at onn: sartak | 2007-12-18 12:45:27 -0500
Revert 4649 js memoization which caused .error div problems
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 Tue Dec 18 12:45:42 2007
@@ -107,31 +107,17 @@
// -----------------------------------------------------------------------
// Jifty: special case of the descent selector. this is by far the most time
-// consuming code path of JS. special casing and caching it saves roughly
-// 15% of JS time
-selectAllCache = {};
+// consuming code path of JS. special casing it does cut JS time a bit
selectAll = function($results, $from) {
- var cache = selectAllCache[$from];
- var i;
-
- if (!cache) {
- var $element, $subset, j;
- var $elements = new Array();
-
- for (i = 0; i < $from.length; i++) {
- $subset = $from[i].getElementsByTagName("*");
- for (j = 0; ($element = $subset[j]); j++) {
- if (thisElement($element))
- $elements.push($element);
- }
- }
-
- selectAllCache[$from] = cache = $elements;
- }
-
- for (i in cache) {
- $results.push(cache[i]);
- }
+ // loop through current selection
+ var $element, $subset, i, j;
+ for (i = 0; i < $from.length; i++) {
+ $subset = $from[i].getElementsByTagName("*");
+ for (j = 0; ($element = $subset[j]); j++) {
+ if (thisElement($element))
+ $results.push($element);
+ }
+ }
};
// descendant selector
More information about the Jifty-commit
mailing list