diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/html/javascripts/dragdrop.js | 2 | ||||
-rw-r--r-- | railties/html/javascripts/effects.js | 7 |
2 files changed, 5 insertions, 4 deletions
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) { |