Skip to content

Commit 9f37a51

Browse files
Markus Amalthea Magnusonajpiano
Markus Amalthea Magnuson
authored andcommitted
Style guide fixes for the index, contributing, and About jQuery articles. Fixes jquery#270
1 parent 051b6c7 commit 9f37a51

File tree

4 files changed

+89
-91
lines changed

4 files changed

+89
-91
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ customFields:
77
---
88

99
Depending on your level of experience with some of the workflows common to many
10-
open source projects, e.g., git/Github, the command line, and setting up a
10+
open source projects, e.g. git/GitHub, the command line, and setting up a
1111
local development environment, contributing to this site may be a breeze or
1212
come with a bit of a learning curve. If you fit into the former group, great!
1313
Jump ahead to learn how to get started.

page/about-jquery/additional-support.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ There are many subforums where you can discuss jQuery, ask questions, talk about
2727
* [Developing jQuery Plugins](http://forum.jquery.com/developing-jquery-plugins)
2828
* This forum covers development of jQuery plugins.
2929
* [Developing jQuery UI](http://forum.jquery.com/developing-jquery-ui)
30-
* This is the place to discuss development of [jQuery UI](http://jqueryui.com/) itself - including bugs, new plugins, and how you can help.
30+
* This is the place to discuss development of [jQuery UI](http://jqueryui.com/) itself including bugs, new plugins, and how you can help.
3131
* All jQuery UI svn commits are posted to this list to facilitate feedback, discussion, and review.
3232
* Also note that a lot of the development and planning of jQuery UI takes place on the [jQuery UI Development and Planning Wiki](http://wiki.jqueryui.com/).
3333
* [Developing jQuery Mobile](http://forum.jquery.com/developing-jquery-mobile)
@@ -41,12 +41,12 @@ To ensure that you'll get a useful answer in no time, please consider the follow
4141

4242
* Ensure your markup is valid.
4343
* Use Firebug/Developer Tools to see if you have an exception.
44-
* Use Firebug/Developer Tools to inspect the html classes, css. etc.
45-
* Try expected resulting html and css without javascript/jQuery and see if the problem could be isolated to those two.
44+
* Use Firebug/Developer Tools to inspect the HTML classes, CSS, etc.
45+
* Try expected resulting HTML and CSS without JavaScript/jQuery and see if the problem could be isolated to those two.
4646
* Reduce to a minimal test case (keep removing things until the problem goes away, etc.)
47-
* Provide that test case as part of your mail. Either upload it somewhere or post it on jsbin.com.
47+
* Provide that test case as part of your mail. Either upload it somewhere or post it on [jsbin.com](http://jsbin.com/).
4848

49-
In general, keep your question short and focused and provide only essential details - others can be added when required.
49+
In general, keep your question short and focused and provide only essential details others can be added when required.
5050

5151
### Mailing List Archives
5252

@@ -71,8 +71,8 @@ The IRC Channel is best if you need quick help with any of the following:
7171

7272
* JavaScript
7373
* jQuery syntax
74-
* problem solving
75-
* strange bugs.
74+
* Problem solving
75+
* Strange bugs
7676

7777
If your problem is more in-depth, we may ask you to post to the mailing list, or the bug tracker, so that we can help you in a more-suitable environment.
7878

page/about-jquery/how-jquery-works.md

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ level: beginner
55
### jQuery: The Basics
66

77
This is a basic tutorial, designed to help you get started using jQuery. If you
8-
don't have a test page setup yet, start by creating the following HTML page:
8+
don't have a test page setup yet, start by creating the following HTML page:
99

1010
```
1111
<!doctype html>
1212
<html>
13-
<head>
14-
<meta charset="utf-8">
15-
<title>Demo</title>
16-
</head>
17-
<body>
18-
<a href="http://jquery.com/">jQuery</a>
19-
<script src="jquery.js"></script>
20-
<script>
21-
// Your code goes here
22-
</script>
23-
</body>
13+
<head>
14+
<meta charset="utf-8">
15+
<title>Demo</title>
16+
</head>
17+
<body>
18+
<a href="http://jquery.com/">jQuery</a>
19+
<script src="jquery.js"></script>
20+
<script>
21+
// Your code goes here
22+
</script>
23+
</body>
2424
</html>
2525
```
2626

@@ -30,77 +30,77 @@ and store the `jquery.js` file in the same directory as your HTML file.
3030

3131
### Launching Code on Document Ready
3232

33-
To ensure that their code runs after the browser finishes loading the document,
33+
To ensure that their code runs after the browser finishes loading the document,
3434
many JavaScript programmers wrap their code in an `onload` function:
3535

3636
```
3737
window.onload = function() {
38-
alert("welcome");
38+
alert( "welcome" );
3939
}
4040
```
4141

4242
Unfortunately, the code doesn't run until all images are finished downloading, including banner ads.
43-
To run code as soon as the `document` is ready to be manipulated, jQuery has a statement
44-
known as the [ ready event ](http://api.jquery.com/ready):
43+
To run code as soon as the `document` is ready to be manipulated, jQuery has a statement
44+
known as the [ready event](http://api.jquery.com/ready):
4545

4646
```
47-
$( document ).ready( function() {
48-
// Your code here
47+
$( document ).ready(function() {
48+
// Your code here
4949
});
5050
```
5151

5252
For example, inside the `ready` event, you can add a click handler to the link:
5353

5454
```
5555
$( document ).ready(function() {
56-
$("a").click(function( event ) {
57-
alert("Thanks for visiting!");
58-
});
56+
$( "a" ).click(function( event ) {
57+
alert( "Thanks for visiting!" );
58+
});
5959
});
6060
```
6161

62-
Save your HTML file and reload the test page in your browser.
63-
Clicking the link should now first display an alert pop-up,
62+
Save your HTML file and reload the test page in your browser.
63+
Clicking the link should now first display an alert pop-up,
6464
then continue with the default behavior of navigating to http://jquery.com.
6565

66-
For `click` and most other [events](http://api.jquery.com/category/events/),
66+
For `click` and most other [events](http://api.jquery.com/category/events/),
6767
you can prevent the default behavior by calling `event.preventDefault()` in the event handler:
6868

6969
```
7070
$( document ).ready(function() {
71-
$("a").click(function( event ) {
72-
alert("As you can see, the link no longer took you to jquery.com");
73-
event.preventDefault();
74-
});
71+
$( "a" ).click(function( event ) {
72+
alert( "As you can see, the link no longer took you to jquery.com" );
73+
event.preventDefault();
74+
});
7575
});
7676
```
7777

7878
### Complete Example
7979

8080
The following example illustrates the click handling code discussed above,
8181
embedded directly in the HTML `<body>`. Note that in practice,
82-
it is usually better to place your code in a separate JS file
82+
it is usually better to place your code in a separate JS file
8383
and load it on the page with a `<script>` element's `src` attribute.
8484

8585
```
8686
<!doctype html>
8787
<html>
88-
<head>
89-
<meta charset="utf-8">
90-
<title>Demo</title>
91-
</head>
92-
<body>
93-
<a href="http://jquery.com/">jQuery</a>
94-
<script src="jquery.js"></script>
95-
<script>
96-
$( document ).ready(function() {
97-
$("a").click(function( event ) {
98-
alert("The link will no longer take you to jquery.com");
99-
event.preventDefault();
100-
});
101-
});
102-
</script>
103-
</body>
88+
<head>
89+
<meta charset="utf-8">
90+
<title>Demo</title>
91+
</head>
92+
<body>
93+
<a href="http://jquery.com/">jQuery</a>
94+
<script src="jquery.js"></script>
95+
<script>
96+
$( document ).ready(function() {
97+
$( "a" ).click(function( event ) {
98+
alert( "The link will no longer take you to jquery.com" );
99+
event.preventDefault();
100+
});
101+
});
102+
</script>
103+
</body>
104104
</html>
105105
```
106106

@@ -114,24 +114,24 @@ First, add some style information into the `<head>` of the document, like this:
114114

115115
```
116116
<style>
117-
a.test {
118-
font-weight: bold;
119-
}
117+
a.test {
118+
font-weight: bold;
119+
}
120120
</style>
121121
```
122122

123123
Next, add the [addClass()](http://api.jquery.com/addClass) call to the script:
124124

125125
```
126-
$("a").addClass("test");
126+
$( "a" ).addClass( "test" );
127127
```
128128

129129
All `a` elements are now bold.
130130

131131
To remove an existing `class`, use [removeClass()](http://api.jquery.com/removeClass):
132132

133133
```
134-
$("a").removeClass("test");
134+
$( "a" ).removeClass( "test" );
135135
```
136136

137137
### Special Effects
@@ -141,9 +141,9 @@ to help you make your web sites stand out.
141141
For example, if you create a click handler of:
142142

143143
```
144-
$("a").click(function( event ){
145-
event.preventDefault();
146-
$( this ).hide("slow");
144+
$( "a" ).click(function( event ){
145+
event.preventDefault();
146+
$( this ).hide( "slow" );
147147
});
148148
```
149149

@@ -155,7 +155,7 @@ Unlike many other programming languages, JavaScript enables you to freely pass f
155155
A *callback* is a function that is passed as an argument to another function and
156156
is executed after its parent function has completed. Callbacks are special because
157157
they patiently wait to execute until their parent finishes.
158-
Meanwhile, the browser can be executing other functions or doing all sorts of other work.
158+
Meanwhile, the browser can be executing other functions or doing all sorts of other work.
159159

160160
To use callbacks, it is important to know how to pass them into their parent function.
161161

@@ -172,31 +172,31 @@ When [$.get](http://api.jquery.com/jQuery.get/) finishes getting the page `myhtm
172172

173173
### Callback *with* Arguments
174174

175-
Executing callbacks with arguments can be tricky.
175+
Executing callbacks with arguments can be tricky.
176176

177177
#### Wrong
178178
This code example will ***not*** work:
179179

180180
```
181-
$.get( "myhtmlpage.html", myCallBack(param1, param2) );
181+
$.get( "myhtmlpage.html", myCallBack( param1, param2 ) );
182182
```
183183

184-
The reason this fails is that the code executes `myCallBack( param1, param2 )` immediately
185-
and then passes the myCallBack's *return value* as the second parameter to `$.get`.
186-
We actually want to pass the function `myCallBack`, not `myCallBack( param1, param2)`'s return value
184+
The reason this fails is that the code executes `myCallBack( param1, param2 )` immediately
185+
and then passes myCallBack's *return value* as the second parameter to `$.get`.
186+
We actually want to pass the function `myCallBack`, not `myCallBack( param1, param2 )`'s return value
187187
(which might or might not be a function). So, how to pass in `myCallBack` *and* include its arguments?
188188

189189
#### Right
190190

191191
To defer executing `myCallBack` with its parameters, you can use an anonymous function as a wrapper.
192192
Note the use of `function() {`. The anonymous function does exactly one thing: calls
193-
`myCallBack`, with the values of `param1` and `param2`.
193+
`myCallBack`, with the values of `param1` and `param2`.
194194

195195
```
196-
$.get( "myhtmlpage.html", function() {
197-
myCallBack( param1, param2 );
198-
});
196+
$.get( "myhtmlpage.html", function() {
197+
myCallBack( param1, param2 );
198+
});
199199
```
200200

201201
When `$.get` finishes getting the page `myhtmlpage.html`, it executes the anonymous function,
202-
which executes `myCallBack( param1, param2 )`.
202+
which executes `myCallBack( param1, param2 )`.

page/index.html

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
<script>{
2-
"title": "jQuery Learning Site",
3-
"pageTemplate": "home.php",
4-
"customFields": [{ "key": "icon", "value": "home" }, { "key": "is_chapter", "value": 0 }]
2+
"title": "jQuery Learning Site",
3+
"pageTemplate": "home.php",
4+
"customFields": [{ "key": "icon", "value": "home" }, { "key": "is_chapter", "value": 0 }]
55
}</script>
66
<div id="banner-secondary" class="large-banner">
77

8-
<h1>Learning Center</h1>
8+
<h1>Learning Center</h1>
99

10-
<div class="row">
11-
<aside class="six columns" id="for-users">
12-
<h2>Users</h2>
13-
<p>
14-
There&rsquo;s a lot more to learn about building web sites and applications with jQuery than can fit in API documentation.
15-
If you&rsquo;re looking for explanations of the basics, workarounds for common problems, best practices, and how-tos, you&rsquo;re in the right place!</p>
16-
</p>
17-
</aside>
10+
<div class="row">
1811

19-
<aside class="six columns" id="for-authors">
20-
<h2>Authors</h2>
21-
<p>Too much good information is spread across corners of the web, languishing in blog and forum posts, often just out of the reach of
22-
people who need it, while the same questionable advice is duplicated across even more questionable sites. Help us stem the tide and educate today&apos;s &mdash; and tomorrow&rsquo;s &mdash; web developers.</p>
23-
</aside>
24-
</div>
12+
<aside class="six columns" id="for-users">
13+
<h2>Users</h2>
14+
<p>There's a lot more to learn about building web sites and applications with jQuery than can fit in API documentation. If you're looking for explanations of the basics, workarounds for common problems, best practices, and how-tos, you're in the right place!</p>
15+
</aside>
2516

26-
</div>
17+
<aside class="six columns" id="for-authors">
18+
<h2>Authors</h2>
19+
<p>Too much good information is spread across corners of the web, languishing in blog and forum posts, often just out of reach of people who need it, while the same questionable advice is duplicated across even more questionable sites. Help us stem the tide and educate today's — and tomorrow's — web developers.</p>
20+
</aside>
21+
22+
</div>
23+
24+
</div>

0 commit comments

Comments
 (0)