Skip to content

Commit 46143c2

Browse files
committed
jQuery.widget: Adding code examples for the various permutations of the option() method.
1 parent 7b37310 commit 46143c2

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

entries/jQuery.widget.xml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,65 @@ this._on( this.element, {
224224
]]></code>
225225
</example>
226226
</method>
227-
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
227+
<method name="option" return="jQuery">
228+
<desc>
229+
Sets one or more options for the <placeholder name="name"/>.
230+
</desc>
231+
<signature return="Object" example-return-var="isDisabled" example-params='"disabled"'>
232+
<desc>Gets the value currently associated with the specified <code>optionName</code>.</desc>
233+
<argument name="optionName" type="String">
234+
<desc>The name of the option to get.</desc>
235+
</argument>
236+
<example>
237+
<desc>Retrieve the value of the <code>width</code> option.</desc>
238+
<code><![CDATA[
239+
this.option( "width" );
240+
]]></code>
241+
</example>
242+
</signature>
243+
<signature return="PlainObject" example-return-var="options">
244+
<desc>Gets an object containing key/value pairs representing the current <placeholder name="name"/> options hash.</desc>
245+
<example>
246+
<desc>Log the key and value of each of the widget's options for debugging.</desc>
247+
<code><![CDATA[
248+
var options = this.option();
249+
for ( var key in options ) {
250+
console.log( key, options[ key ] );
251+
}
252+
]]></code>
253+
</example>
254+
</signature>
255+
<signature example-params='"disabled", true'>
256+
<desc>Sets the value of the <placeholder name="name"/> option associated with the specified <code>optionName</code>.</desc>
257+
<argument name="optionName" type="String">
258+
<desc>The name of the option to set.</desc>
259+
</argument>
260+
<argument name="value" type="Object">
261+
<desc>A value to set for the option.</desc>
262+
</argument>
263+
<example>
264+
<desc>Set the <code>width</code> option to <code>500</code>.</desc>
265+
<code><![CDATA[
266+
this.option( "width", 500 );
267+
]]></code>
268+
</example>
269+
</signature>
270+
<signature example-params="{ disabled: true }">
271+
<desc>Sets one or more options for the <placeholder name="name"/>.</desc>
272+
<argument name="options" type="Object">
273+
<desc>A map of option-value pairs to set.</desc>
274+
</argument>
275+
<example>
276+
<desc>Set the <code>height</code> and <code>width</code> options to <code>500</code>.</desc>
277+
<code><![CDATA[
278+
this.option({
279+
width: 500,
280+
height: 500
281+
});
282+
]]></code>
283+
</example>
284+
</signature>
285+
</method>
228286
<method name="widget" return="jQuery" example-return-var="widget">
229287
<desc>
230288
Returns a <code>jQuery</code> object containing the <placeholder name="widget-element"/>.

0 commit comments

Comments
 (0)