Opened 13 years ago
Closed 13 years ago
#4877 closed enhancement (fixed)
Enhance ui-tabs list "UL:first" selector to allow for alternative markup
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | 1.8 |
Component: | ui.tabs | Version: | 1.7.2 |
Keywords: | ui tabs UL list selector | Cc: | |
Blocked by: | Blocking: |
Description
The ui-tabs plugin is hard coded to assume that the <ul> list is a child of the current element.
The code in question is in the _tabify method:
_tabify: function(init) {
this.list = this.element.children('ul:first'); ...
}
This limits the markup to have to match >UL:first. Use any other markup and the tabs plugin will fail to locate the <ul> list.
I changed the code to use find() instead of children() and added an option to the defaults as follows: (Note the use of ">" in the selector to ensure find() continues to work the way children() does currently by default)
_tabify: function(init) {
this.list = this.element.find(this.options.listSelector); ...
}
defaults: {
...
listSelector: '>ul:first'
}
Now, when we initialise the tabs plugin, we can specify listSelector: '>DIV>ul:first' to handle my non-standard markup.
George
Attachments (1)
Change History (2)
Changed 13 years ago by
Attachment: | ui.tabs.js added |
---|
comment:1 Changed 13 years ago by
Component: | ui.core → ui.tabs |
---|---|
Milestone: | TBD → 1.8 |
Resolution: | → fixed |
Status: | new → closed |
Fixed in r3421. Tabs now uses the first descendant list it encounters. This isn't as flexible as your proposal, but doesn't require any additional options.
ui.tabs.js with UL selector enhancements on lines 75 and 630