Skip to content

Commit bac5e33

Browse files
committed
Merge branch 'master' into fix_method_refs
* master: (21 commits) 0.2.7 Remove remaining trailing whitespace from all pages. Fixes jquery#313. Style and typography fixes, and code style adherence in the JavaScript 101 section. Fixes jquery#312. 0.2.6 Correct comment in :input selector in Selecting Elements article. Fixes jquery#306. Expand the JavaScript 101 'Scope' article with more useful information and explanations. Fixes jquery#201. Added 0 to the list of falsy values in JavaScript 101 Conditional Code article. Fixes jquery#300. Fixes jquery#271 Inserted missing word in the JavaScript 101 Arrays article. Fixes jquery#299. Fixed inconsistency in showLinkLocation example in Basic Plugin Creation article. Fixes jquery#307. Fix example and other style cleanup in Basic Plugin Creation article. Fixes jquery#310. Fixes jquery#311. Update list of reserved words in JavaScript. Fixes jquery#301. Style and typography fixes and code style adherence in the Events section. Fixes jquery#294. Style and typography fixes, and code style adherence in the Effects section. Fixes jquery#290. Style and typography fixes, and code style adherence in the Code Organization section. Fixes jquery#287. Remove double ampersands in README header. Fixes jquery#284. Code and prose style improvements to all articles in Ajax chapter. Fixes jquery#283. Style fixes on the About page. Fixes jquery#279. Style guide fixes for the index, contributing, and About jQuery articles. Fixes jquery#270 relabel queue/dequeue content as advanced Added a missing 'i' in the for loop. Fixes jquery#280. ... Conflicts: page/ajax/ajax-and-forms.md page/ajax/jquery-ajax-methods.md page/effects/custom-effects.md page/effects/intro-to-effects.md page/events/event-basics.md page/events/event-helpers.md page/events/introduction-to-custom-events.md page/events/triggering-event-handlers.md
2 parents 19d5d88 + 2d88c58 commit bac5e33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2081
-2370
lines changed

CONTRIBUTING.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Contributing
3-
customFields:
3+
customFields:
44
-
55
key: "is_chapter"
66
value: 0
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.
@@ -38,7 +38,7 @@ you are probably familiar with the frustrating feeling of putting a useful tip
3838
out there, and then wondering if it's actually making its way to the people who
3939
need it, and what to do with that old post years and versions down the road.
4040
You're invited to share that energy to help us bring that ecosystem together
41-
and grow it further!
41+
and grow it further!
4242

4343
If you've ever helped anyone, colleague or stranger, with a particular problem,
4444
then you know the value of having a reference you can quickly link to that says
@@ -71,7 +71,7 @@ controls most of the layout for all of our sites, and there is a [child
7171
theme](https://github.com/jquery/jquery-wp-content/tree/master/themes/learn.jquery.com)
7272
that controls the templates and styles specific to the learn site.
7373

74-
[`jquery-wp-content`](http://github.com/jquery/jquery-wp-content) powers our sites in
74+
[`jquery-wp-content`](http://github.com/jquery/jquery-wp-content) powers our sites in
7575
production and staging environments, and can set up for local development relatively easily.
7676

7777
### Build
@@ -80,7 +80,7 @@ The static content in the `page` directory is deployed to a
8080
[`jquery-wp-content`](http://github.com/jquery/jquery-wp-content) instance
8181
using [grunt](http://gruntjs.com), specifically with two grunt plugins we've created:
8282

83-
* [grunt-jquery-content](http://github.com/jquery/grunt-jquery-content) - pre-processes content in a variety of formats (HTML, Markdown, XML) into HTML, applying syntax highlighting and some simple partial support, preparing it for processing by
83+
* [grunt-jquery-content](http://github.com/jquery/grunt-jquery-content) - pre-processes content in a variety of formats (HTML, Markdown, XML) into HTML, applying syntax highlighting and some simple partial support, preparing it for processing by
8484
* [grunt-wordpress](http://github.com/scottgonzalez/grunt-wordpress) - syncs static content to WordPress using [XML-RPC](http://codex.wordpress.org/XML-RPC_Support)
8585

8686

@@ -129,7 +129,7 @@ Once you've gotten your environment working, here are the general steps you shou
129129

130130
1. Create a new "feature" branch based on `master` -- `git branch <feature/issue name/number>`
131131
2. Move onto that branch -- `git checkout <feature/issue name/number>`
132-
3. Work on your awesome contribution.
132+
3. Work on your awesome contribution.
133133
4. As you work and want to preview your changes, use `grunt` to deploy them to the your site. You can also use `grunt watch` to have the site monitor the `page` directory for any changes and automatically have the changes deployed every time you save.
134134
5. When you're done, stage the new/modified preparation for commit -- `git add page/faq/how-do-i-add-a-new-article-to-the-learn-site.md`
135135
6. Commit the files to your local repo -- `git commit -m "add a relevant message describing the change"`
@@ -142,10 +142,10 @@ Requests](http://contribute.jquery.org/commits-and-pull-requests/) guide.
142142

143143
### Adding A New Article
144144

145-
1. Add the file to the right folder in the page folder.
145+
1. Add the file to the right folder in the page folder.
146146
2. Add the slug name (the filename without the extension) to the desired location `order.yml`
147147
3. Run `grunt`
148-
4. You should now be able to navigate to the file.
148+
4. You should now be able to navigate to the file.
149149

150150
### Formatting Articles
151151

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Each of the articles on the site has some [YAML "Front Matter"](https://github.c
3636

3737
`level: advanced`
3838

39-
## Building && Working Locally
39+
## Building & Working Locally
4040

4141
As this site is part of the jQuery network of sites, its presentation is controlled by our [web base template](https://github.com/jquery/jquery-wp-content). To preview the site locally, first follow the [instructions there](https://github.com/jquery/jquery-wp-content) to set up a local version of the jQuery WordPress network. Then, clone this repo and run the following steps (node.js required).
4242

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "learn.jquery.com",
33
"title": "jQuery Learning Site",
44
"description": "jQuery Foundation site for learning jQuery and JavaScript",
5-
"version": "0.2.5",
5+
"version": "0.2.7",
66
"homepage": "http://learn.jquery.com",
77
"author": {
88
"name": "jQuery Foundation (http://jquery.org/)"

page/about-jquery/additional-support.md

+7-7
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

+64-64
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 )`.

0 commit comments

Comments
 (0)