aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-12-11 15:57:49 -0500
committerScott González <scott.gonzalez@gmail.com>2010-12-11 15:57:49 -0500
commitf73d4217537e130e2f41a7ee6729585a5c229107 (patch)
tree6490c0cda308b36a3860f71b142f08e4a1fce24c
parentca0ac5a64f6653fe8399a913538423b13d213307 (diff)
downloadjquery-ui-f73d4217537e130e2f41a7ee6729585a5c229107.tar.gz
jquery-ui-f73d4217537e130e2f41a7ee6729585a5c229107.zip
Accordion: Split out navigation options into an extension. Fixes #5869 - Accordion: Deprecate navigation options.
-rw-r--r--ui/jquery.ui.accordion.js54
1 files changed, 36 insertions, 18 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 0f404b90c..d134d3b6b 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -26,10 +26,6 @@ $.widget( "ui.accordion", {
icons: {
header: "ui-icon-triangle-1-e",
headerSelected: "ui-icon-triangle-1-s"
- },
- navigation: false,
- navigationFilter: function() {
- return this.href.toLowerCase() === location.href.toLowerCase();
}
},
@@ -77,20 +73,6 @@ $.widget( "ui.accordion", {
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
self.headers.find( ":first-child" ).addClass( "ui-accordion-heading" );
- if ( options.navigation ) {
- var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
- if ( current.length ) {
- var header = current.closest( ".ui-accordion-header" );
- if ( header.length ) {
- // anchor within header
- self.active = header;
- } else {
- // anchor within content
- self.active = current.closest( ".ui-accordion-content" ).prev();
- }
- }
- }
-
self.active = self._findActive( self.active || options.active )
.addClass( "ui-state-default ui-state-active" )
.toggleClass( "ui-corner-all" )
@@ -598,4 +580,40 @@ $.extend( $.ui.accordion, {
}
});
+
+
+// DEPRECATED
+
+// navigation options
+(function( $, prototype ) {
+ $.extend( prototype.options, {
+ navigation: false,
+ navigationFilter: function() {
+ return this.href.toLowerCase() === location.href.toLowerCase();
+ }
+ });
+
+ var _create = prototype._create;
+ prototype._create = function() {
+ if ( this.options.navigation ) {
+ var self = this,
+ headers = this.element.find( this.options.header ),
+ content = headers.next();
+ current = headers.add( content )
+ .find( "a" )
+ .filter( this.options.navigationFilter )
+ [ 0 ];
+ if ( current ) {
+ headers.add( content ).each( function( index ) {
+ if ( $.contains( this, current ) ) {
+ self.options.active = Math.floor( index / 2 );
+ return false;
+ }
+ });
+ }
+ }
+ _create.call( this );
+ };
+}( jQuery, jQuery.ui.accordion.prototype ));
+
})( jQuery );