[Jifty-commit] r4647 - in jifty/trunk: share/web/static/js/cssquery
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Dec 7 16:58:13 EST 2007
Author: sartak
Date: Fri Dec 7 16:58:13 2007
New Revision: 4647
Modified:
jifty/trunk/ (props changed)
jifty/trunk/share/web/static/js/cssquery/cssQuery.js
Log:
r48770 at onn: sartak | 2007-12-07 16:57:54 -0500
cssquery.js: thisElement is being called 11000 times for hiveminder's /todo. It includes an IE workaround. Use the workaround only if we're actually using IE. This cuts its runtime on /todo from ~220ms to ~100ms
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 Fri Dec 7 16:58:13 2007
@@ -169,9 +169,20 @@
// IE5/6 includes comments (LOL) in it's elements collections.
// so we have to check for this. the test is tagName != "!". LOL (again).
-var thisElement = function($element) {
- return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null;
-};
+
+// Jifty: since we call this a LOT (11000 times for Hiveminder's /) we check
+// tagName only if IE. this cuts its runtime to half in all but IE
+var thisElement;
+if (Prototype.Browser.IE) {
+ thisElement = function($element) {
+ return ($element && $element.nodeType == 1 && $element.tagName != "!") ? $element : null;
+ };
+}
+else {
+ thisElement = function($element) {
+ return ($element && $element.nodeType == 1) ? $element : null;
+ };
+}
// return the previous element to the supplied element
// previousSibling is not good enough as it might return a text or comment node
More information about the Jifty-commit
mailing list