diff options
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/dragdrop.js | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/effects.js | 7 | ||||
-rw-r--r-- | railties/html/javascripts/dragdrop.js | 2 | ||||
-rw-r--r-- | railties/html/javascripts/effects.js | 7 |
4 files changed, 10 insertions, 8 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) { diff --git a/railties/html/javascripts/dragdrop.js b/railties/html/javascripts/dragdrop.js index f59c1f2997..f1dc7ea2ab 100644 --- a/railties/html/javascripts/dragdrop.js +++ b/railties/html/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/railties/html/javascripts/effects.js b/railties/html/javascripts/effects.js index e23554ecad..bcf836b83c 100644 --- a/railties/html/javascripts/effects.js +++ b/railties/html/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) { |