Skip to content

Commit 3139dbf

Browse files
committed
jQuery.widget: Final updates to widget method examples. Fixes #76.
1 parent 46143c2 commit 3139dbf

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

entries/jQuery.widget.xml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,13 @@ this._off( this.element, "click" );
475475
Invokes the method of the same name from the parent widget, with any specified arguments. Essentially <code>.call()</code>.
476476
</desc>
477477
<example>
478-
<desc>Handle the width option and call the parent widget's <code>_setOption()</code> method to handle all other options.</desc>
478+
<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>
479479
<code><![CDATA[
480480
_setOption: function( key, value ) {
481-
if ( key === "width" ) {
482-
this.resize();
483-
} else {
484-
this._super( key, value );
481+
if ( key === "title" ) {
482+
this.element.find( "h3" ).text( value );
485483
}
484+
this._super( key, value );
486485
}
487486
]]></code>
488487
</example>
@@ -495,14 +494,13 @@ _setOption: function( key, value ) {
495494
<desc>Array of arguments to pass to the parent method.</desc>
496495
</argument>
497496
<example>
498-
<desc>Handle the width option and call the parent widget's <code>_setOption()</code> method to handle all other options.</desc>
497+
<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>
499498
<code><![CDATA[
500499
_setOption: function( key, value ) {
501-
if ( key === "width" ) {
502-
this.resize();
503-
} else {
504-
this._superApply( arguments );
500+
if ( key === "title" ) {
501+
this.element.find( "h3" ).text( value );
505502
}
503+
this._superApply( arguments );
506504
}
507505
]]></code>
508506
</example>
@@ -636,7 +634,7 @@ this._show( this.element, this.options.show, function() {
636634
this._hide( this.element, this.options.hide, function() {
637635
638636
// Remove the element from the DOM when it's fully hidden.
639-
this.remove();
637+
$( this ).remove();
640638
});
641639
]]></code>
642640
</example>

0 commit comments

Comments
 (0)