Ticket #8207 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

Tabs: Error with href selector.

Reported by: mdibbets Owned by:
Priority: minor Milestone: 1.8.19
Component: ui.tabs Version: 1.8.18
Keywords: Cc:
Blocking: Blocked by:

Description

In the current version of jqueryui there is an error when trying to select a tab by url and not by index.

The error lies in the following.

The code currently used is:

 _getIndex: function( index ) {
		// meta-function to give users option to provide a href string instead of a numerical index.
		// also sanitizes numerical indexes to valid values.
		if ( typeof index == "string" ) {
			index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
		}

		return index;
	},

There is an error since jquery requires quotes nowadays.

 _getIndex: function( index ) {
		// meta-function to give users option to provide a href string instead of a numerical index.
		// also sanitizes numerical indexes to valid values.
		if ( typeof index == "string" ) {
			index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
		}

		return index;
	},

The above is the corrected code. This works perfectly.

If I may suggest, also highlight in the documentation that when generating tabs from ajax etc...(I use php backend to dynamically generate tabs for editorial purposes of a magazine and all have a different url), that you can also use the URL instead of tab index. It's not really mentioned there, but it is a life saver when using dynamically generated tabs.

Also, please include a feature that you can check if a tab with a certain ajax url already exists.

Change History

comment:1 Changed 2 years ago by scott.gonzalez

  • Summary changed from [href= error to Tabs: Error with href selector.

comment:2 Changed 2 years ago by Scott González

  • Status changed from new to closed
  • Resolution set to fixed

Tabs: Wrap attribute value in quotes when querying. Fixes #8207 - Tabs: Error with href selector.

Changeset: adbc2733bbd4d4c117dd2e0f31d5156e2913bfd1

comment:3 Changed 2 years ago by Scott González

Tabs: Wrap attribute value in quotes when querying. Fixes #8207 - Tabs: Error with href selector. (cherry picked from commit adbc2733bbd4d4c117dd2e0f31d5156e2913bfd1)

Changeset: 090ce4369d12751f2e55e62f6cc7f7fbc5dc6f2a

comment:4 Changed 2 years ago by scott.gonzalez

  • Milestone changed from 1.9 to 1.8.19
Note: See TracTickets for help on using tickets.