Skip to content

Commit 27d5a47

Browse files
agcolomscottgonzalez
authored andcommitted
Code indentation and formatting (s entries)
1 parent 8c3a3fa commit 27d5a47

18 files changed

+738
-494
lines changed

entries/scroll.xml

+35-20
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
<added>1.0</added>
2222
</signature>
2323
<longdesc>
24-
<p>This method is a shortcut for <code>.on('scroll', handler)</code> in the first and second variations, and <code>.trigger('scroll')</code> in the third.</p>
24+
<p>This method is a shortcut for <code>.on( "scroll", handler )</code> in the first and second variations, and <code>.trigger( "scroll" )</code> in the third.</p>
2525
<p>The <code>scroll</code> event is sent to an element when the user scrolls to a different place in the element. It applies to <code>window</code> objects, but also to scrollable frames and elements with the <code>overflow </code>CSS property set to <code>scroll</code> (or <code>auto</code> when the element's explicit height or width is less than the height or width of its contents).</p>
2626
<p>For example, consider the HTML:</p>
27-
<pre><code>&lt;div id="target" style="overflow: scroll; width: 200px; height: 100px;"&gt;
27+
<pre><code>
28+
&lt;div id="target" style="overflow: scroll; width: 200px; height: 100px;"&gt;
2829
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
2930
sed do eiusmod tempor incididunt ut labore et dolore magna
3031
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
@@ -37,43 +38,57 @@
3738
&lt;div id="other"&gt;
3839
Trigger the handler
3940
&lt;/div&gt;
40-
&lt;div id="log"&gt;&lt;/div&gt;</code></pre>
41+
&lt;div id="log"&gt;&lt;/div&gt;
42+
</code></pre>
4143
<p>The style definition is present to make the target element small enough to be scrollable:</p>
4244
<p class="image">
4345
<img src="/resources/0042_05_11.png" alt=""/>
4446
</p>
4547
<p>The <code>scroll</code> event handler can be bound to this element:</p>
46-
<pre><code>$('#target').scroll(function() {
47-
$('#log').append('&lt;div&gt;Handler for .scroll() called.&lt;/div&gt;');
48-
});</code></pre>
48+
<pre><code>
49+
$( "#target" ).scroll(function() {
50+
$( "#log" ).append( "&lt;div&gt;Handler for .scroll() called.&lt;/div&gt;" );
51+
});
52+
</code></pre>
4953
<p>Now when the user scrolls the text up or down, one or more messages are appended to <code>&lt;div id="log"&gt;&lt;/div&gt;</code>:</p>
5054
<p>
5155
<samp>Handler for .scroll() called.</samp>
5256
</p>
5357
<p>To trigger the event manually, apply <code>.scroll()</code> without an argument:</p>
54-
<pre><code>$('#other').click(function() {
55-
$('#target').scroll();
56-
});</code></pre>
58+
<pre><code>
59+
$( "#other" ).click(function() {
60+
$( "#target" ).scroll();
61+
});
62+
</code></pre>
5763
<p>After this code executes, clicks on <samp>Trigger the handler</samp> will also append the message.</p>
5864
<p>A <code>scroll</code> event is sent whenever the element's scroll position changes, regardless of the cause. A mouse click or drag on the scroll bar, dragging inside the element, pressing the arrow keys, or using the mouse's scroll wheel could cause this event.</p>
5965
</longdesc>
6066
<example>
6167
<desc>To do something when your page is scrolled:</desc>
6268
<code><![CDATA[
63-
$("p").clone().appendTo(document.body);
64-
$("p").clone().appendTo(document.body);
65-
$("p").clone().appendTo(document.body);
66-
$(window).scroll(function () {
67-
$("span").css("display", "inline").fadeOut("slow");
69+
$( "p" ).clone().appendTo( document.body );
70+
$( "p" ).clone().appendTo( document.body );
71+
$( "p" ).clone().appendTo( document.body );
72+
$( window ).scroll(function() {
73+
$( "span" ).css( "display", "inline" ).fadeOut( "slow" );
6874
});
6975
]]></code>
7076
<css><![CDATA[
71-
div { color:blue; }
72-
p { color:green; }
73-
span { color:red; display:none; }
74-
]]></css>
75-
<html><![CDATA[<div>Try scrolling the iframe.</div>
76-
<p>Paragraph - <span>Scroll happened!</span></p>]]></html>
77+
div {
78+
color: blue;
79+
}
80+
p {
81+
color: green;
82+
}
83+
span {
84+
color: red;
85+
display: none;
86+
}
87+
]]></css>
88+
<html><![CDATA[
89+
<div>Try scrolling the iframe.</div>
90+
<p>Paragraph - <span>Scroll happened!</span></p>
91+
]]></html>
7792
</example>
7893
<category slug="events/browser-events"/>
7994
<category slug="version/1.0"/>

entries/scrollLeft.xml

+32-16
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@
1515
</longdesc>
1616
<example>
1717
<desc>Get the scrollLeft of a paragraph.</desc>
18-
<code><![CDATA[var p = $("p:first");
19-
$("p:last").text( "scrollLeft:" + p.scrollLeft() );
18+
<code><![CDATA[
19+
var p = $( "p:first" );
20+
$( "p:last" ).text( "scrollLeft:" + p.scrollLeft() );
2021
]]></code>
2122
<css><![CDATA[
22-
p { margin:10px;padding:5px;border:2px solid #666; }
23+
p {
24+
margin: 10px;
25+
padding: 5px;
26+
border: 2px solid #666;
27+
}
2328
]]></css>
24-
<html><![CDATA[<p>Hello</p><p></p>]]></html>
29+
<html><![CDATA[
30+
<p>Hello</p><p></p>
31+
]]></html>
2532
</example>
2633
<category slug="css"/>
2734
<category slug="offset"/>
@@ -41,22 +48,31 @@ $("p:last").text( "scrollLeft:" + p.scrollLeft() );
4148
</longdesc>
4249
<example>
4350
<desc>Set the scrollLeft of a div.</desc>
44-
<code><![CDATA[$("div.demo").scrollLeft(300);
51+
<code><![CDATA[
52+
$( "div.demo" ).scrollLeft( 300 );
4553
]]></code>
4654
<css><![CDATA[
4755
div.demo {
48-
background:#CCCCCC none repeat scroll 0 0;
49-
border:3px solid #666666;
50-
margin:5px;
51-
padding:5px;
52-
position:relative;
53-
width:200px;
54-
height:100px;
55-
overflow:auto;
56+
background: #ccc none repeat scroll 0 0;
57+
border: 3px solid #666;
58+
margin: 5px;
59+
padding: 5px;
60+
position: relative;
61+
width: 200px;
62+
height: 100px;
63+
overflow: auto;
64+
}
65+
p {
66+
margin: 10px;
67+
padding: 5px;
68+
border: 2px solid #666;
69+
width: 1000px;
70+
height: 1000px;
5671
}
57-
p { margin:10px;padding:5px;border:2px solid #666;width:1000px;height:1000px; }
58-
]]></css>
59-
<html><![CDATA[<div class="demo"><h1>lalala</h1><p>Hello</p></div>]]></html>
72+
]]></css>
73+
<html><![CDATA[
74+
<div class="demo"><h1>lalala</h1><p>Hello</p></div>
75+
]]></html>
6076
</example>
6177
<category slug="css"/>
6278
<category slug="offset"/>

entries/scrollTop.xml

+35-19
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@
1111
</longdesc>
1212
<example>
1313
<desc>Get the scrollTop of a paragraph.</desc>
14-
<code><![CDATA[var p = $("p:first");
15-
$("p:last").text( "scrollTop:" + p.scrollTop() );
14+
<code><![CDATA[
15+
var p = $( "p:first" );
16+
$( "p:last" ).text( "scrollTop:" + p.scrollTop() );
1617
]]></code>
1718
<css><![CDATA[
18-
p { margin:10px;padding:5px;border:2px solid #666; }
19-
]]></css>
20-
<html><![CDATA[<p>Hello</p><p></p>]]></html>
19+
p {
20+
margin: 10px;
21+
padding: 5px;
22+
border: 2px solid #666;
23+
}
24+
]]></css>
25+
<html><![CDATA[
26+
<p>Hello</p><p></p>
27+
]]></html>
2128
</example>
2229
<category slug="css"/>
2330
<category slug="offset"/>
@@ -37,22 +44,31 @@ $("p:last").text( "scrollTop:" + p.scrollTop() );
3744
</longdesc>
3845
<example>
3946
<desc>Set the scrollTop of a div.</desc>
40-
<code><![CDATA[$("div.demo").scrollTop(300);
47+
<code><![CDATA[
48+
$( "div.demo" ).scrollTop( 300 );
4149
]]></code>
4250
<css><![CDATA[
43-
div.demo {
44-
background:#CCCCCC none repeat scroll 0 0;
45-
border:3px solid #666666;
46-
margin:5px;
47-
padding:5px;
48-
position:relative;
49-
width:200px;
50-
height:100px;
51-
overflow:auto;
52-
}
53-
p { margin:10px;padding:5px;border:2px solid #666;width:1000px;height:1000px; }
54-
]]></css>
55-
<html><![CDATA[<div class="demo"><h1>lalala</h1><p>Hello</p></div>]]></html>
51+
div.demo {
52+
background: #ccc none repeat scroll 0 0;
53+
border: 3px solid #666;
54+
margin: 5px;
55+
padding: 5px;
56+
position: relative;
57+
width: 200px;
58+
height: 100px;
59+
overflow: auto;
60+
}
61+
p {
62+
margin: 10px;
63+
padding: 5px;
64+
border: 2px solid #666;
65+
width: 1000px;
66+
height: 1000px;
67+
}
68+
]]></css>
69+
<html><![CDATA[
70+
<div class="demo"><h1>lalala</h1><p>Hello</p></div>
71+
]]></html>
5672
</example>
5773
<category slug="css"/>
5874
<category slug="offset"/>

entries/select.xml

+31-22
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,28 @@
2121
<added>1.0</added>
2222
</signature>
2323
<longdesc>
24-
<p>This method is a shortcut for <code>.on('select', handler)</code> in the first two variations, and <code>.trigger('select')</code> in the third.</p>
24+
<p>This method is a shortcut for <code>.on( "select", handler )</code> in the first two variations, and <code>.trigger( "select" )</code> in the third.</p>
2525
<p>The <code>select</code> event is sent to an element when the user makes a text selection inside it. This event is limited to <code>&lt;input type="text"&gt;</code> fields and <code>&lt;textarea&gt;</code> boxes.</p>
2626
<p>For example, consider the HTML:</p>
27-
<pre><code>&lt;form&gt;
28-
&lt;input id="target" type="text" value="Hello there" /&gt;
27+
<pre><code>
28+
&lt;form&gt;
29+
&lt;input id="target" type="text" value="Hello there"&gt;
2930
&lt;/form&gt;
3031
&lt;div id="other"&gt;
3132
Trigger the handler
3233
&lt;/div&gt;</code></pre>
3334
<p>The event handler can be bound to the text input:</p>
34-
<pre><code>$('#target').select(function() {
35-
alert('Handler for .select() called.');
36-
});</code></pre>
35+
<pre><code>
36+
$( "#target" ).select(function() {
37+
alert( "Handler for .select() called." );
38+
});
39+
</code></pre>
3740
<p>Now when any portion of the text is selected, the alert is displayed. Merely setting the location of the insertion point will not trigger the event. To trigger the event manually, apply <code>.select()</code> without an argument:</p>
38-
<pre><code>$('#other').click(function() {
39-
$('#target').select();
40-
});</code></pre>
41+
<pre><code>
42+
$( "#other").click(function() {
43+
$( "#target" ).select();
44+
});
45+
</code></pre>
4146
<p>After this code executes, clicks on the Trigger button will also alert the message:</p>
4247
<p>
4348
<samp>Handler for .select() called.</samp>
@@ -50,26 +55,30 @@
5055
<example>
5156
<desc>To do something when text in input boxes is selected:</desc>
5257
<code><![CDATA[
53-
$(":input").select( function () {
54-
$("div").text("Something was selected").show().fadeOut(1000);
58+
$( ":input" ).select(function() {
59+
$( "div" ).text( "Something was selected" ).show().fadeOut( 1000 );
5560
});
5661
]]></code>
5762
<css><![CDATA[
58-
p { color:blue; }
59-
div { color:red; }
60-
]]></css>
63+
p {
64+
color: blue;
65+
}
66+
div {
67+
color: red;
68+
}
69+
]]></css>
6170
<html><![CDATA[
62-
<p>
63-
Click and drag the mouse to select text in the inputs.
64-
</p>
65-
<input type="text" value="Some text" />
66-
<input type="text" value="to test on" />
67-
68-
<div></div>]]></html>
71+
<p>Click and drag the mouse to select text in the inputs.</p>
72+
<input type="text" value="Some text">
73+
<input type="text" value="to test on">
74+
<div></div>
75+
]]></html>
6976
</example>
7077
<example>
7178
<desc>To trigger the select event on all input elements, try:</desc>
72-
<code><![CDATA[$("input").select();]]></code>
79+
<code><![CDATA[
80+
$( "input" ).select();
81+
]]></code>
7382
</example>
7483
<category slug="events/form-events"/>
7584
<category slug="forms"/>

entries/selected-selector.xml

+22-20
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,33 @@
1313
<example>
1414
<desc>Attaches a change event to the select that gets the text for each selected option and writes them in the div. It then triggers the event for the initial text draw.</desc>
1515
<code><![CDATA[
16-
$("select").change(function () {
16+
$( "select" ).change(function() {
1717
var str = "";
18-
$("select option:selected").each(function () {
19-
str += $(this).text() + " ";
20-
});
21-
$("div").text(str);
18+
$( "select option:selected" ).each(function() {
19+
str += $( this ).text() + " ";
20+
});
21+
$( "div" ).text( str );
2222
})
23-
.trigger('change');
23+
.trigger( "change" );
2424
]]></code>
2525
<css><![CDATA[
26-
div { color:red; }
27-
]]></css>
28-
<html><![CDATA[<select name="garden" multiple="multiple">
29-
30-
<option>Flowers</option>
31-
<option selected="selected">Shrubs</option>
32-
<option>Trees</option>
33-
<option selected="selected">Bushes</option>
34-
35-
<option>Grass</option>
36-
<option>Dirt</option>
37-
</select>
38-
<div></div>]]></html>
26+
div {
27+
color: red;
28+
}
29+
]]></css>
30+
<html><![CDATA[
31+
<select name="garden" multiple="multiple">
32+
<option>Flowers</option>
33+
<option selected="selected">Shrubs</option>
34+
<option>Trees</option>
35+
<option selected="selected">Bushes</option>
36+
<option>Grass</option>
37+
<option>Dirt</option>
38+
</select>
39+
<div></div>
40+
]]></html>
3941
</example>
4042
<category slug="selectors/form-selectors"/>
4143
<category slug="selectors/jquery-selector-extensions"/>
4244
<category slug="version/1.0"/>
43-
</entry>
45+
</entry>

entries/selector.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</signature>
77
<desc>A selector representing selector passed to jQuery(), if any, when creating the original set.</desc>
88
<longdesc>
9-
<p>The <code>.selector</code> property was deprecated in jQuery 1.7 and is only maintained to the extent needed for supporting <code>.live()</code> in the jQuery Migrate plugin. It may be removed without notice in a future version. The property was never a reliable indicator of the selector that could be used to obtain the set of elements currently contained in the jQuery set where it was a property, since subsequent traversal methods may have changed the set. Plugins that need to use a selector should have the caller pass in the selector as part of the plugin's arguments during initialization.</p>
9+
<p>The <code>.selector</code> property was deprecated in jQuery 1.7 and is only maintained to the extent needed for supporting <code>.live()</code> in the jQuery Migrate plugin. It may be removed without notice in a future version. The property was never a reliable indicator of the selector that could be used to obtain the set of elements currently contained in the jQuery set where it was a property, since subsequent traversal methods may have changed the set. Plugins that need to use a selector string within their plugin can require it as a parameter of the method. For example, a "foo" plugin could be written as <code>$.fn.foo = function( selector, options ) { /* plugin code goes here */ };</code>, and the person using the plugin would write <code>$( "div.bar" ).foo( "div.bar", {dog: "bark"} );</code> with the <code>"div.bar"</code> selector repeated as the first argument of <code>.foo()</code>.</p>
1010
</longdesc>
1111
<category slug="internals"/>
1212
<category slug="properties/global-jquery-object-properties"/>

0 commit comments

Comments
 (0)