Skip to content

Commit 5d6024a

Browse files
committed
jQuery.widget: Change the _super() and _superApply() examples to do something other than the default behavior.
1 parent 8245cc7 commit 5d6024a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

entries/jQuery.widget.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,14 @@ this._off( this.element, "click" );
375375
Invokes the method of the same name from the parent widget, with any specified arguments. Essentially <code>.call()</code>.
376376
</desc>
377377
<example>
378-
<desc>Call the parent widget's <code>_setOption()</code> method.</desc>
378+
<desc>Handle the width option and call the parent widget's <code>_setOption()</code> method to handle all other options.</desc>
379379
<code><![CDATA[
380380
_setOption: function( key, value ) {
381-
this._super( key, value );
381+
if ( key === "width" ) {
382+
this.resize();
383+
} else {
384+
this._super( key, value );
385+
}
382386
}
383387
]]></code>
384388
</example>
@@ -391,10 +395,14 @@ _setOption: function( key, value ) {
391395
<desc>Array of arguments to pass to the parent method.</desc>
392396
</argument>
393397
<example>
394-
<desc>Call the parent widget's <code>_setOption()</code> method.</desc>
398+
<desc>Handle the width option and call the parent widget's <code>_setOption()</code> method to handle all other options.</desc>
395399
<code><![CDATA[
396400
_setOption: function( key, value ) {
397-
this._superApply( arguments );
401+
if ( key === "width" ) {
402+
this.resize();
403+
} else {
404+
this._superApply( arguments );
405+
}
398406
}
399407
]]></code>
400408
</example>

0 commit comments

Comments
 (0)