Skip to content
Browse files

jQuery.widget: Adding code examples for the various permutations of t…

…he option() method.
  • Loading branch information...
1 parent 7b37310 commit 46143c2163dc7bd3ce403e45ee9b995ace7d1221 @tjvantoll tjvantoll committed
Showing with 59 additions and 1 deletion.
  1. +59 −1 entries/jQuery.widget.xml
View
60 entries/jQuery.widget.xml
@@ -224,7 +224,65 @@ this._on( this.element, {
]]></code>
</example>
</method>
- <xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
+ <method name="option" return="jQuery">
+ <desc>
+ Sets one or more options for the <placeholder name="name"/>.
+ </desc>
+ <signature return="Object" example-return-var="isDisabled" example-params='"disabled"'>
+ <desc>Gets the value currently associated with the specified <code>optionName</code>.</desc>
+ <argument name="optionName" type="String">
+ <desc>The name of the option to get.</desc>
+ </argument>
+ <example>
+ <desc>Retrieve the value of the <code>width</code> option.</desc>
+ <code><![CDATA[
+this.option( "width" );
+]]></code>
+ </example>
+ </signature>
+ <signature return="PlainObject" example-return-var="options">
+ <desc>Gets an object containing key/value pairs representing the current <placeholder name="name"/> options hash.</desc>
+ <example>
+ <desc>Log the key and value of each of the widget's options for debugging.</desc>
+ <code><![CDATA[
+var options = this.option();
+for ( var key in options ) {
+ console.log( key, options[ key ] );
+}
+]]></code>
+ </example>
+ </signature>
+ <signature example-params='"disabled", true'>
+ <desc>Sets the value of the <placeholder name="name"/> option associated with the specified <code>optionName</code>.</desc>
+ <argument name="optionName" type="String">
+ <desc>The name of the option to set.</desc>
+ </argument>
+ <argument name="value" type="Object">
+ <desc>A value to set for the option.</desc>
+ </argument>
+ <example>
+ <desc>Set the <code>width</code> option to <code>500</code>.</desc>
+ <code><![CDATA[
+this.option( "width", 500 );
+]]></code>
+ </example>
+ </signature>
+ <signature example-params="{ disabled: true }">
+ <desc>Sets one or more options for the <placeholder name="name"/>.</desc>
+ <argument name="options" type="Object">
+ <desc>A map of option-value pairs to set.</desc>
+ </argument>
+ <example>
+ <desc>Set the <code>height</code> and <code>width</code> options to <code>500</code>.</desc>
+ <code><![CDATA[
+this.option({
+ width: 500,
+ height: 500
+});
+]]></code>
+ </example>
+ </signature>
+ </method>
<method name="widget" return="jQuery" example-return-var="widget">
<desc>
Returns a <code>jQuery</code> object containing the <placeholder name="widget-element"/>.

0 comments on commit 46143c2

Please sign in to comment.
Something went wrong with that request. Please try again.