aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.tabs.js
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2012-01-22 14:47:21 +0100
committerFelix Nagel <info@felixnagel.com>2012-01-22 14:47:21 +0100
commit21d96f12f802f13c4c159ab9b2e0a6df3771be42 (patch)
treec74f69270a62bc8a99e175bd3a94c7bc18433a48 /ui/jquery.ui.tabs.js
parent725023e30db10cc0a3ec2b8b9fda0ec80a4ab496 (diff)
parent6800e1a2f97a7d8aaf20d065aa2ce517528e5068 (diff)
downloadjquery-ui-21d96f12f802f13c4c159ab9b2e0a6df3771be42.tar.gz
jquery-ui-21d96f12f802f13c4c159ab9b2e0a6df3771be42.zip
Merge branch 'master' of github.com:jquery/jquery-ui into selectmenu
Diffstat (limited to 'ui/jquery.ui.tabs.js')
-rw-r--r--ui/jquery.ui.tabs.js37
1 files changed, 23 insertions, 14 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 5c9fc1326..7a701405c 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -13,23 +13,20 @@
*/
(function( $, undefined ) {
-var tabId = 0;
+var tabId = 0,
+ rhash = /#.*$/;
+
function getNextTabId() {
return ++tabId;
}
-var isLocal = (function() {
- var rhash = /#.*$/,
- currentPage = location.href.replace( rhash, "" );
-
- return function( anchor ) {
- // clone the node to work around IE 6 not normalizing the href property
- // if it's manually set, i.e., a.href = "#foo" kills the normalization
- anchor = anchor.cloneNode( false );
- return anchor.hash.length > 1 &&
- anchor.href.replace( rhash, "" ) === currentPage;
- };
-})();
+var isLocal = function( anchor ) {
+ // clone the node to work around IE 6 not normalizing the href property
+ // if it's manually set, i.e., a.href = "#foo" kills the normalization
+ anchor = anchor.cloneNode( false );
+ return anchor.hash.length > 1 &&
+ anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
+};
$.widget( "ui.tabs", {
version: "@VERSION",
@@ -123,6 +120,13 @@ $.widget( "ui.tabs", {
}
},
+ _getCreateEventData: function() {
+ return {
+ tab: this.active,
+ panel: !this.active.length ? $() : this._getPanelForTab( this.active )
+ };
+ },
+
_setOption: function( key, value ) {
if ( key == "active" ) {
// _activate() will handle invalid values and update this.options
@@ -212,7 +216,7 @@ $.widget( "ui.tabs", {
_processTabs: function() {
var self = this;
- this.list = this.element.find( "ol,ul" ).eq( 0 );
+ this.list = this._getList();
this.lis = $( " > li:has(a[href])", this.list );
this.anchors = this.lis.map(function() {
return $( "a", this )[ 0 ];
@@ -244,6 +248,11 @@ $.widget( "ui.tabs", {
});
},
+ // allow overriding how to find the list for rare usage scenarios (#7715)
+ _getList: function() {
+ return this.element.find( "ol,ul" ).eq( 0 );
+ },
+
_createPanel: function( id ) {
return $( "<div></div>" )
.attr( "id", id )