aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorThomas Fuchs <thomas@fesch.at>2006-03-27 08:14:02 +0000
committerThomas Fuchs <thomas@fesch.at>2006-03-27 08:14:02 +0000
commit1cc2f5ce9f2e343532cfe2b9554f62d363f37afb (patch)
treeb31eb89e830f066ef45be7768470d1109eb1d426 /actionpack/lib
parented6c3c17f79bd4b5ad91e2473193551e3441769e (diff)
downloadrails-1cc2f5ce9f2e343532cfe2b9554f62d363f37afb.tar.gz
rails-1cc2f5ce9f2e343532cfe2b9554f62d363f37afb.tar.bz2
rails-1cc2f5ce9f2e343532cfe2b9554f62d363f37afb.zip
Speedup for sortable with handles initialization in rails trunk too
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4068 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/dragdrop.js2
-rw-r--r--actionpack/lib/action_view/helpers/javascripts/effects.js7
2 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/dragdrop.js b/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
index f59c1f2997..f1dc7ea2ab 100644
--- a/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
+++ b/actionpack/lib/action_view/helpers/javascripts/dragdrop.js
@@ -208,7 +208,7 @@ Draggable.prototype = {
this.element = $(element);
if(options.handle && (typeof options.handle == 'string'))
- this.handle = Element.childrenWithClassName(this.element, options.handle)[0];
+ this.handle = Element.childrenWithClassName(this.element, options.handle, true)[0];
if(!this.handle) this.handle = $(options.handle);
if(!this.handle) this.handle = this.element;
diff --git a/actionpack/lib/action_view/helpers/javascripts/effects.js b/actionpack/lib/action_view/helpers/javascripts/effects.js
index e23554ecad..bcf836b83c 100644
--- a/actionpack/lib/action_view/helpers/javascripts/effects.js
+++ b/actionpack/lib/action_view/helpers/javascripts/effects.js
@@ -76,9 +76,10 @@ Element.getInlineOpacity = function(element){
return $(element).style.opacity || '';
}
-Element.childrenWithClassName = function(element, className) {
- return $A($(element).getElementsByTagName('*')).select(
- function(c) { return Element.hasClassName(c, className) });
+Element.childrenWithClassName = function(element, className, findFirst) {
+ return [$A($(element).getElementsByTagName('*'))[findFirst ? 'detect' : 'select']( function(c) {
+ return c.className ? Element.hasClassName(c, className) : false;
+ })].flatten();
}
Element.forceRerendering = function(element) {