]> source.dussan.org Git - jquery-ui.git/commitdiff
accordion: simplified find-header-element code, thanks Ariel
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sun, 22 Jun 2008 19:08:35 +0000 (19:08 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Sun, 22 Jun 2008 19:08:35 +0000 (19:08 +0000)
ui/ui.accordion.js

index c7828cd9dc34b55ca3c37031d88fd91d33039ea2..089073a16184543c0138d0a877967e1276e69957 100644 (file)
@@ -179,9 +179,8 @@ function clickHandler(event) {
        
        // due to the event delegation model, we have to check if one
        // of the parent elements is our actual header, and find that
-       if ( clicked.parents(options.header).length ) {
-               clicked = clicked.parents(options.header + ":first");
-       }
+       // otherwise stick with the initial target
+       clicked = $( clicked.parents(options.header)[0] || clicked );
        
        var clickedActive = clicked[0] == options.active[0];