Skip to content

Commit e9019ad

Browse files
authored
Accordion: Document the new header signature in UI 1.13
Ref jquery/jquery-ui#1904 Closes gh-338
1 parent 0acbf53 commit e9019ad

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

entries/accordion.xml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,27 @@
107107
<option name="event" type="String" default='"click"' example-value='"mouseover"'>
108108
<desc>The event that accordion headers will react to in order to activate the associated panel. Multiple events can be specified, separated by a space.</desc>
109109
</option>
110-
<option name="header" type="Selector" default='"> li > :first-child,> :not(li):even"' example-value='"h3"'>
111-
<desc>
112-
<p>Selector for the header element, applied via <code>.find()</code> on the main accordion element. Content panels must be the sibling immediately after their associated headers.</p>
113-
</desc>
110+
<option name="header" default='function( elem ) { return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() ); }' example-value='"h3"'>
111+
<desc>Data identifying the header element. Content panels must be the sibling immediately after their associated headers.</desc>
112+
<type name="Selector">
113+
<desc>Selector for the header element, applied via <code>.find()</code> on the main accordion element.</desc>
114+
</type>
115+
<type name="Function">
116+
<argument name="accordionElement" type="jQuery">
117+
<desc>The accordion element</desc>
118+
</argument>
119+
<desc>A function accepting the accordion element and returning the header element.</desc>
120+
</type>
121+
<example>
122+
<desc>Initialize the accordion with the <code>header</code> option specified as a function:</desc>
123+
<code>
124+
$( ".selector" ).accordion({
125+
header: function ( accordionElement ) {
126+
return accordionElement.find( "h3" );
127+
}
128+
});
129+
</code>
130+
</example>
114131
</option>
115132
<option name="heightStyle" type="String" default='"auto"' example-value='"fill"'>
116133
<desc>

0 commit comments

Comments
 (0)