Skip to content

Commit 6817f59

Browse files
committed
jQuery.widget: Adding examples for _super() and _superApply().
1 parent 7333b30 commit 6817f59

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

entries/jQuery.widget.xml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ _setOptions: function( options ) {
265265
266266
$.each( options, function( key, value ) {
267267
that._setOption( key, value );
268-
if ( key == "height" || key == "width" ) {
268+
if ( key === "height" || key === "width" ) {
269269
resize = true;
270270
}
271271
});
@@ -294,10 +294,10 @@ _setOptions: function( options ) {
294294
<desc>Update a widget's element when its <code>height</code> or <code>width</code> option changes.</desc>
295295
<code><![CDATA[
296296
_setOption: function( key, value ) {
297-
if ( key == "width" ) {
297+
if ( key === "width" ) {
298298
this.element.width( value );
299299
}
300-
if ( key == "height" ) {
300+
if ( key === "height" ) {
301301
this.element.height( value );
302302
}
303303
this._super( key, value );
@@ -359,6 +359,14 @@ this._off( this.element, "click" );
359359
<desc>
360360
Invokes the method of the same name from the parent widget, with any specified arguments. Essentially <code>.call()</code>.
361361
</desc>
362+
<example>
363+
<desc>Call the parent widget's <code>_setOption()</code> method.</desc>
364+
<code><![CDATA[
365+
_setOption: function( key, value ) {
366+
this._super( key, value );
367+
}
368+
]]></code>
369+
</example>
362370
</method>
363371
<method name="_superApply">
364372
<desc>
@@ -367,6 +375,14 @@ this._off( this.element, "click" );
367375
<argument name="arguments" type="Array">
368376
<desc>Array of arguments to pass to the parent method.</desc>
369377
</argument>
378+
<example>
379+
<desc>Call the parent widget's <code>_setOption()</code> method.</desc>
380+
<code><![CDATA[
381+
_setOption: function( key, value ) {
382+
this._superApply( arguments );
383+
}
384+
]]></code>
385+
</example>
370386
</method>
371387
<method name="_delay" return="Number">
372388
<desc>
@@ -414,7 +430,7 @@ this._hoverable( this.element.find( "div" ) );
414430
<example>
415431
<desc>Apply focusable styling to a set of elements within the widget.</desc>
416432
<code><![CDATA[
417-
this._focusable( this.element.find( "my-items" ) );
433+
this._focusable( this.element.find( ".my-items" ) );
418434
]]></code>
419435
</example>
420436
</method>

0 commit comments

Comments
 (0)