Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

jQuery.widget: Final updates to widget method examples. Fixes #76.

  • Loading branch information...
commit 3139dbf276efe0c2db7a2081cef78b5d231a43ba 1 parent 46143c2
TJ VanToll tjvantoll authored
Showing with 9 additions and 11 deletions.
  1. +9 −11 entries/jQuery.widget.xml
20 entries/jQuery.widget.xml
View
@@ -475,14 +475,13 @@ this._off( this.element, "click" );
Invokes the method of the same name from the parent widget, with any specified arguments. Essentially <code>.call()</code>.
</desc>
<example>
- <desc>Handle the width option and call the parent widget's <code>_setOption()</code> method to handle all other options.</desc>
+ <desc>Handle <code>title</code> option updates and call the parent widget's <code>_setOption()</code> to update the internal storage of the option.</desc>
<code><![CDATA[
_setOption: function( key, value ) {
- if ( key === "width" ) {
- this.resize();
- } else {
- this._super( key, value );
+ if ( key === "title" ) {
+ this.element.find( "h3" ).text( value );
}
+ this._super( key, value );
}
]]></code>
</example>
@@ -495,14 +494,13 @@ _setOption: function( key, value ) {
<desc>Array of arguments to pass to the parent method.</desc>
</argument>
<example>
- <desc>Handle the width option and call the parent widget's <code>_setOption()</code> method to handle all other options.</desc>
+ <desc>Handle <code>title</code> option updates and call the parent widget's <code>_setOption()</code> to update the internal storage of the option.</desc>
<code><![CDATA[
_setOption: function( key, value ) {
- if ( key === "width" ) {
- this.resize();
- } else {
- this._superApply( arguments );
+ if ( key === "title" ) {
+ this.element.find( "h3" ).text( value );
}
+ this._superApply( arguments );
}
]]></code>
</example>
@@ -636,7 +634,7 @@ this._show( this.element, this.options.show, function() {
this._hide( this.element, this.options.hide, function() {
// Remove the element from the DOM when it's fully hidden.
- this.remove();
+ $( this ).remove();
});
]]></code>
</example>
Please sign in to comment.
Something went wrong with that request. Please try again.