@@ -102,28 +102,49 @@ define([
102
102
* @private
103
103
*/
104
104
_processPanels : function ( ) {
105
- this . contents = this . element . children ( this . options . content ) ;
105
+ var isNotNested = this . _isNotNested . bind ( this ) ;
106
106
107
- this . collapsibles = this . element . children ( this . options . collapsibleElement ) ;
107
+ this . contents = this . element
108
+ . find ( this . options . content )
109
+ . filter ( isNotNested ) ;
110
+
111
+ this . collapsibles = this . element
112
+ . find ( this . options . collapsibleElement )
113
+ . filter ( isNotNested ) ;
108
114
109
115
this . collapsibles
110
116
. attr ( 'role' , 'presentation' )
111
117
. parent ( )
112
118
. attr ( 'role' , 'tablist' ) ;
113
119
114
- this . headers = this . element . children ( this . options . header ) ;
120
+ this . headers = this . element
121
+ . find ( this . options . header )
122
+ . filter ( isNotNested ) ;
115
123
116
124
if ( this . headers . length === 0 ) {
117
125
this . headers = this . collapsibles ;
118
126
}
119
- this . triggers = this . element . children ( this . options . trigger ) ;
127
+ this . triggers = this . element
128
+ . find ( this . options . trigger )
129
+ . filter ( isNotNested ) ;
120
130
121
131
if ( this . triggers . length === 0 ) {
122
132
this . triggers = this . headers ;
123
133
}
124
134
this . _callCollapsible ( ) ;
125
135
} ,
126
136
137
+ /**
138
+ * @param {HTMLElement } elem
139
+ * @private
140
+ * @return {Boolean }
141
+ */
142
+ _isNotNested : function ( index , element ) {
143
+ var parentContent = $ ( element ) . parents ( this . options . content ) ;
144
+
145
+ return ! parentContent . length || ! this . element . find ( parentContent ) . length ;
146
+ } ,
147
+
127
148
/**
128
149
* Setting the disabled and active tabs and calling instantiation of collapsible
129
150
* @private
0 commit comments