Skip to content

Commit dfb2a85

Browse files
committed
jQuery.widget: Fix context of _hide() and _show() examples.
1 parent 5d6024a commit dfb2a85

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

entries/jQuery.widget.xml

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@
184184
<desc>Destroy the widget when any of its anchors are clicked.</desc>
185185
<code><![CDATA[
186186
this._on( this.element, {
187-
"click a": function( event ) {
188-
event.preventDefault();
189-
this.destroy();
190-
}
187+
"click a": function( event ) {
188+
event.preventDefault();
189+
this.destroy();
190+
}
191191
});
192192
]]></code>
193193
</example>
@@ -275,19 +275,19 @@ _init: function() {
275275
<desc>Call a <code>resize()</code> method if the <code>height</code> or <code>width</code> options change.</desc>
276276
<code><![CDATA[
277277
_setOptions: function( options ) {
278-
var that = this,
279-
resize = false;
280-
281-
$.each( options, function( key, value ) {
282-
that._setOption( key, value );
283-
if ( key === "height" || key === "width" ) {
284-
resize = true;
285-
}
286-
});
287-
288-
if ( resize ) {
289-
this.resize();
290-
}
278+
var that = this,
279+
resize = false;
280+
281+
$.each( options, function( key, value ) {
282+
that._setOption( key, value );
283+
if ( key === "height" || key === "width" ) {
284+
resize = true;
285+
}
286+
});
287+
288+
if ( resize ) {
289+
this.resize();
290+
}
291291
}
292292
]]></code>
293293
</example>
@@ -309,13 +309,13 @@ _setOptions: function( options ) {
309309
<desc>Update a widget's element when its <code>height</code> or <code>width</code> option changes.</desc>
310310
<code><![CDATA[
311311
_setOption: function( key, value ) {
312-
if ( key === "width" ) {
313-
this.element.width( value );
314-
}
315-
if ( key === "height" ) {
316-
this.element.height( value );
317-
}
318-
this._super( key, value );
312+
if ( key === "width" ) {
313+
this.element.width( value );
314+
}
315+
if ( key === "height" ) {
316+
this.element.height( value );
317+
}
318+
this._super( key, value );
319319
}
320320
]]></code>
321321
</example>
@@ -344,9 +344,9 @@ _setOption: function( key, value ) {
344344
<desc>Prevent the default action of all links clicked within the widget's element.</desc>
345345
<code><![CDATA[
346346
this._on( this.element, {
347-
"click a": function( event ) {
348-
event.preventDefault();
349-
}
347+
"click a": function( event ) {
348+
event.preventDefault();
349+
}
350350
});
351351
]]></code>
352352
</example>
@@ -378,11 +378,11 @@ this._off( this.element, "click" );
378378
<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-
if ( key === "width" ) {
382-
this.resize();
383-
} else {
384-
this._super( key, value );
385-
}
381+
if ( key === "width" ) {
382+
this.resize();
383+
} else {
384+
this._super( key, value );
385+
}
386386
}
387387
]]></code>
388388
</example>
@@ -398,11 +398,11 @@ _setOption: function( key, value ) {
398398
<desc>Handle the width option and call the parent widget's <code>_setOption()</code> method to handle all other options.</desc>
399399
<code><![CDATA[
400400
_setOption: function( key, value ) {
401-
if ( key === "width" ) {
402-
this.resize();
403-
} else {
404-
this._superApply( arguments );
405-
}
401+
if ( key === "width" ) {
402+
this.resize();
403+
} else {
404+
this._superApply( arguments );
405+
}
406406
}
407407
]]></code>
408408
</example>
@@ -511,8 +511,8 @@ this._on( this.element, {
511511
<code><![CDATA[
512512
this._show( this.element, this.options.show, function() {
513513
514-
// Focus an item when the element is fully visible
515-
this.mainElement.focus();
514+
// Focus the element when it's fully visible.
515+
this.focus();
516516
}]]></code>
517517
</example>
518518
</method>
@@ -535,8 +535,8 @@ this._show( this.element, this.options.show, function() {
535535
<code><![CDATA[
536536
this._hide( this.element, this.options.hide, function() {
537537
538-
// Trigger a close event when the element is fully hidden
539-
this._trigger( "close" );
538+
// Remove the element from the DOM when it's fully hidden.
539+
this.remove();
540540
});
541541
]]></code>
542542
</example>

0 commit comments

Comments
 (0)