From 1abf45eeba43cbd72944ea57b8cd87e68aebdfd6 Mon Sep 17 00:00:00 2001
From: Jeffery To
Date: Mon, 26 Aug 2013 15:26:42 +0800
Subject: [PATCH 001/331] Removed the Metadata plugin section from Advanced
Plugin Concepts (this addresses the first half of #409)
---
page/plugins/advanced-plugin-concepts.md | 47 ------------------------
1 file changed, 47 deletions(-)
diff --git a/page/plugins/advanced-plugin-concepts.md b/page/plugins/advanced-plugin-concepts.md
index b8fcb649..6181a402 100644
--- a/page/plugins/advanced-plugin-concepts.md
+++ b/page/plugins/advanced-plugin-concepts.md
@@ -138,53 +138,6 @@ So how then do we define more functions without cluttering the namespace and wit
Our "debug" method cannot be accessed from outside of the closure and thus is private to our implementation.
-### Support the Metadata Plugin
-
-Depending on the type of plugin you're writing, adding support for the [Metadata Plugin](http://docs.jquery.com/Plugins/Metadata/metadata) can make it even more powerful. Personally, I love the Metadata Plugin because it lets you use unobtrusive markup to override plugin options (which is particularly useful when creating demos and examples). And supporting it is very simple!
-
-```
-// Plugin definition.
-$.fn.hilight = function( options ) {
-
- // Build main options before element iteration.
- var opts = $.extend( {}, $.fn.hilight.defaults, options );
-
- return this.each(function() {
- var $this = $( this );
-
- // Build element specific options.
- // This changed line tests to see if the Metadata Plugin is installed,
- // And if it is, it extends our options object with the extracted metadata.
- var o = $.meta ? $.extend( {}, opts, $this.data() ) : opts;
-
- //...
-
- });
-
-};
-```
-
-*Note:* This line is added as the last argument to *jQuery.extend* so it will override any other option settings. Now we can drive behavior from the markup if we choose:
-
-```
-
-
- Have a nice day!
-
-
- Have a nice day!
-
-
- Have a nice day!
-
-```
-
-And now we can hilight each of these `
`s uniquely using a single line of script:
-
-```
-$( ".hilight" ).hilight();
-```
-
###Bob and Sue
Let's say Bob has created a wicked new gallery plugin (called "superGallery") which takes a list of images and makes them navigable. Bob's thrown in some animation to make it more interesting. He's tried to make the plugin as customizable as possible, and has ended up with something like this:
From 1458b4ac15c2ec9cb6d87c608eb4b90ae1a0ced7 Mon Sep 17 00:00:00 2001
From: Jon Cameron
Date: Thu, 6 Jun 2013 14:53:56 -0400
Subject: [PATCH 002/331] Removed unnecessary semicolons
---
page/javascript-101/scope.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/page/javascript-101/scope.md b/page/javascript-101/scope.md
index e88e175d..e1069e76 100644
--- a/page/javascript-101/scope.md
+++ b/page/javascript-101/scope.md
@@ -27,7 +27,7 @@ JavaScript also creates a __Local Scope__ inside each function body. For example
```
function myFunc() {
var x = 5;
-};
+}
console.log( x ); // ReferenceError: x is not defined
```
@@ -41,7 +41,7 @@ If you declare a variable and forget to use the `var` keyword, that variable is
```
function myFunc() {
x = 5;
-};
+}
console.log( x ); // 5
```
From 4cf8c5685b73c4c3d9f6d60bd35c6b7b2e2b94e9 Mon Sep 17 00:00:00 2001
From: TJ VanToll
Date: Thu, 5 Sep 2013 08:48:22 -0400
Subject: [PATCH 003/331] Adding article on jQuery widget method invocation.
---
.../widget-method-invocation.md | 64 +++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 page/jquery-ui/widget-factory/widget-method-invocation.md
diff --git a/page/jquery-ui/widget-factory/widget-method-invocation.md b/page/jquery-ui/widget-factory/widget-method-invocation.md
new file mode 100644
index 00000000..9ec783d4
--- /dev/null
+++ b/page/jquery-ui/widget-factory/widget-method-invocation.md
@@ -0,0 +1,64 @@
+---
+title: Widget Method Invocation
+level: intermediate
+---
+
+Widgets created with [the widget factory](/jquery-ui/widget-factory/) use methods to change their state and perform actions after initialization. There are two ways widget methods can be invoked - through the plugin created by the widget factory, or by invoking the method on the element's instance object.
+
+### Plugin Invocation
+
+To invoke a method using the widget's plugin, pass the name of the method as a string. For example, here is how you call the [dialog widget's `close()` method](http://api.jqueryui.com/dialog/#method-close).
+
+```
+$( ".selector" ).dialog( "close" );
+```
+
+If the method requires arguments, pass them as additional parameters to the plugin. Here is how you call [dialog's `option()` method](http://api.jqueryui.com/dialog/#method-option).
+
+```
+$( ".selector" ).dialog( "option", "height" );
+```
+
+This returns the value of the [dialog's `height` option](http://api.jqueryui.com/dialog/#option-height).
+
+### Instance Invocation
+
+Under the hoods, every instance of every widget is stored on the element using [`jQuery.data()`](http://api.jquery.com/jQuery.data/). To retrieve the instance object, call `jQuery.data()` using the widget's full name as the key. Let's look at each.
+
+```
+var dialog = $( ".selector" ).data( "ui-dialog" );
+```
+
+After you have a reference to the instance object, methods can be invoked on it directly.
+
+```
+var dialog = $( ".selector" ).data( "ui-dialog" );
+dialog.close();
+```
+
+In jQuery UI 1.11, the new `instance()` method will make this process even easier.
+
+```
+$( ".selector" ).dialog( "instance" ).close();
+```
+
+### Return Types
+
+Most methods invoked through the widget's plugin will return a `jQuery` object so the method call can be chained with additional jQuery methods.
+
+```
+$( ".selector" )
+ .dialog( "close" )
+ .css( "color", "red" );
+```
+
+The exception to this are methods that return information about the widget. For example [dialog's `isOpen()` method](http://api.jqueryui.com/dialog/#method-isOpen).
+
+```
+$( ".selector" )
+ .dialog( "isOpen" )
+ // This will throw a TypeError
+ .css( "color", "red" );
+```
+
+This produces a `TypeError` error as `isOpen()` returns a boolean, not a jQuery object.
\ No newline at end of file
From 7311bdda38371ce3f6411141fc790f67a50b18e0 Mon Sep 17 00:00:00 2001
From: TJ VanToll
Date: Mon, 16 Sep 2013 13:27:11 -0400
Subject: [PATCH 004/331] New article on extending widgets with the widget
factory.
Minor clarifications.
---
.../widget-factory/extending-widgets.md | 172 ++++++++++++++++++
.../how-to-use-the-widget-factory.md | 24 ++-
2 files changed, 187 insertions(+), 9 deletions(-)
create mode 100644 page/jquery-ui/widget-factory/extending-widgets.md
diff --git a/page/jquery-ui/widget-factory/extending-widgets.md b/page/jquery-ui/widget-factory/extending-widgets.md
new file mode 100644
index 00000000..c5dc8e21
--- /dev/null
+++ b/page/jquery-ui/widget-factory/extending-widgets.md
@@ -0,0 +1,172 @@
+---
+title: Extending Widgets with the Widget Factory
+level: advanced
+---
+
+jQuery UI's widget factory makes it easy to build widgets that extend the functionality of existing widgets. Doing so allows you to build powerful widgets on top of an existing base, as well as make small tweaks to an existing widget's functionality.
+
+**Note:** This article assumes some basic knowledge of what the widget factory is and how it works. If you're unfamiliar with this, read up on [how to use the widget factory](/jquery-ui/widget-factory/how-to-use-the-widget-factory/) first.
+
+### Creating Widget Extensions
+
+Creating widgets with the widget factory is done by passing the name of the widget and a prototype object to `$.widget()`. The following creates a "superDialog" widget in the "custom" namespace.
+
+```
+$.widget( "custom.superDialog", {} );
+```
+
+To allow for extension, `$.widget()` optionally accepts the constructor of a widget to use as a parent. When specifying a parent widget, pass it as the second argument - after the widget's name, and before the widget's prototype object.
+
+Like the previous example, the following also creates a "superDialog" widget in the "custom" namespace. However, this time the constructor of [jQuery UI's dialog widget](http://jqueryui.com/dialog/) (`$.ui.dialog`) is passed, indicating that the superDialog widget should use jQuery UI's dialog widget as a parent.
+
+```
+$.widget( "custom.superDialog", $.ui.dialog, {} );
+```
+
+Here superDialog and dialog are essentially equivalent widgets with different names and namepaces. To make our new widget more interesting we can add methods to its prototype object.
+
+A widget's prototype object is the final argument passed to `$.widget()`. So far, our examples have been using an empty object. Let's add a method to this object:
+
+```
+$.widget( "custom.superDialog", $.ui.dialog, {
+ red: function() {
+ this.element.css( "color", "red" );
+ }
+});
+
+// Create a new
, convert it into a superDialog, and call the red() method.
+$( "
I am red
" )
+ .superDialog()
+ .superDialog( "red" );
+```
+
+Now the `superDialog` has a `red()` method that will change the color of its text to red. Note how the widget factory automatically sets `this` to the widget's instance object. For a full list of the methods and properties available on the instance, see [the widget factory's API documentation](http://api.jqueryui.com/jquery.widget/).
+
+### Extending Existing Methods
+
+Sometimes you need to tweak or add to the behavior of existing widget methods. The do this, specify a method with the same name as the method you want to override on the prototype object. The following example overrides dialog's [`open()` method](http://api.jqueryui.com/dialog/#method-open). Since dialogs automatically open by default, `"open"` will be logged when this code runs.
+
+```
+$.widget( "custom.superDialog", $.ui.dialog, {
+ open: function() {
+ console.log( "open" );
+ }
+});
+
+// Create a new
, and convert it into a superDialog.
+$( "
" ).superDialog();
+```
+
+While this runs, there's a problem. Since we overrode the default behavior of `open()`, the dialog no longer displays on the screen.
+
+When we place methods on the prototype object, we are not actually overriding the original method - rather, we are placing a new method at a higher level in the prototype chain.
+
+To make the parent's methods available, the widget factory provides two methods - `_super()` and `_superApply()`.
+
+### Using `_super()` and `_superApply()` to Access Parents
+
+[`_super()`](http://api.jqueryui.com/jquery.widget/#method-_super) and [`_superApply()`](http://api.jqueryui.com/jquery.widget/#method-_superApply) invoke methods of the same same in the parent widget. Refer to the following example. Like the previous one, this example also overrides the `open()` method to log `"open"`. However, this time `_super()` is run to invoke dialog's `open()` and open the dialog.
+
+```
+$.widget( "custom.superDialog", $.ui.dialog, {
+ open: function() {
+ console.log( "open" );
+
+ // Invoke the parent widget's open().
+ return this._super();
+ }
+});
+
+$( "
" ).superDialog();
+```
+
+`_super()` and `_superApply()` were designed to behave like the native `Function.prototype.call()` and `Function.prototype.apply()` methods. Therefore, `_super()` accepts an argument list, and `_superApply()` accepts a single array of arguments. This difference is shown in the example below.
+
+```
+$.widget( "custom.superDialog", $.ui.dialog, {
+ _setOption: function( key, value ) {
+
+ // Both invoke dialog's setOption() method. _super() requires the arguments
+ // be passed as an argument list, _superApply() as a single array.
+ this._super( key, value );
+ this._superApply( arguments );
+ }
+});
+```
+
+### Redefining Widgets
+
+jQuery UI 1.9 added the ability for widgets to redefine themselves. Therefore, instead of creating a new widget, we can pass `$.widget()` an existing widget's name and constructor. The following example adds the same logging in `open()`, but doesn't create a new widget to do so.
+
+```
+$.widget( "ui.dialog", $.ui.dialog, {
+ open: function() {
+ console.log( "open" );
+ return this._super();
+ }
+});
+
+$( "
" ).dialog();
+```
+
+With this approach you can extend an existing widget's method and still have access to the original methods using `_super()` - all without creating a new widget.
+
+### Widgets and Polymorphism
+
+One word of warning when interacting with widget extensions and their plugins. The parent widget's plugin cannot be used to invoke methods on elements that are child widgets. This is shown in the example below.
+
+```
+$.widget( "custom.superDialog", $.ui.dialog, {} );
+
+var dialog = $( "
" ).superDialog();
+
+// This works.
+dialog.superDialog( "close" );
+
+// This doesn't.
+dialog.dialog( "close" );
+```
+
+Above, the parent widget's plugin, `dialog()`, cannot invoke the `close()` method on an element that is a superDialog. For more on the invoking widget methods see [Widget Method Invocation](/jquery-ui/widget-factory/widget-method-invocation/).
+
+### Customizing Individual Instances
+
+All the examples we have looked at so far have extended methods on the widget's prototype. Methods overridden on the prototype affect all instances of the widget.
+
+To show this, refer to the example below; both instances of the dialog use the same `open()` method.
+
+```
+$.widget( "ui.dialog", $.ui.dialog, {
+ open: function() {
+ console.log( "open" );
+ return this._super();
+ }
+});
+
+// Create two dialogs, both use the same open(), therefore "open" is logged twice.
+$( "
" ).dialog();
+$( "
" ).dialog();
+```
+
+While this is powerful, sometimes you only need to change the behavior for a single instance of the widget. To do this, obtain a reference to the instance and override the method using normal JavaScript property assignment. The example below shows this.
+
+```
+var dialogInstance = $( "
" )
+ .dialog()
+ // Retrieve the dialog's instance and store it.
+ .data( "ui-dialog" );
+
+// Override the close() method for this dialog
+dialogInstance.close = function() {
+ console.log( "close" );
+};
+
+// Create a second dialog
+$( "
" ).dialog();
+
+// Select both dialogs and call close() on each of them.
+// "close" will only be logged once.
+$( ":data(ui-dialog)" ).dialog( "close" );
+```
+
+This technique of overriding methods for individual instances is perfect for one-off customizations.
diff --git a/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md b/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md
index 94acfec0..fe3b175f 100644
--- a/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md
+++ b/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md
@@ -3,7 +3,7 @@ title: How To Use the Widget Factory
level: Beginner
---
-To start, we'll create a progress bar that just lets us set the progress once. As we can see below, this is done by calling `jQuery.widget` with two parameters: the name of the plugin to create, and an object literal containing functions to support our plugin. When our plugin gets called, it will create a new plugin instance and all functions will be executed within the context of that instance. This is different from a standard jQuery plugin in two important ways. First, the context is an object, not a DOM element. Second, the context is always a single object, never a collection.
+To start, we'll create a progress bar that just lets us set the progress once. As we can see below, this is done by calling `jQuery.widget()` with two parameters: the name of the plugin to create, and an object literal containing functions to support our plugin. When our plugin gets called, it will create a new plugin instance and all functions will be executed within the context of that instance. This is different from a standard jQuery plugin in two important ways. First, the context is an object, not a DOM element. Second, the context is always a single object, never a collection.
```
$.widget( "custom.progressbar", {
@@ -16,7 +16,9 @@ $.widget( "custom.progressbar", {
});
```
-The name of the plugin must contain a namespace, in this case we've used the `custom` namespace. There is currently a limitation that exactly one namespace must be used. We can also see that the widget factory has provided two properties for us. `this.element` is a jQuery object containing exactly one element. If our plugin is called on a jQuery object containing multiple elements, a separate plugin instance will be created for each element, and each instance will have its own `this.element`. The second property, `this.options`, is a hash containing key/value pairs for all of our plugin's options. These options can be passed to our plugin as shown here.
+The name of the plugin must contain a namespace, in this case we've used the `custom` namespace. You can only create namespaces that are one level deep, therefore, `custom.progressbar` is a valid plugin name whereas `very.custom.progressbar` is not.
+
+We can also see that the widget factory has provided two properties for us. `this.element` is a jQuery object containing exactly one element. If our plugin is called on a jQuery object containing multiple elements, a separate plugin instance will be created for each element, and each instance will have its own `this.element`. The second property, `this.options`, is a hash containing key/value pairs for all of our plugin's options. These options can be passed to our plugin as shown here.
```
$( "" )
@@ -24,10 +26,11 @@ $( "" )
.progressbar({ value: 20 });
```
-When we call `jQuery.widget` it extends jQuery by adding a function to `jQuery.fn` (the system for creating a standard plugin). The name of the function it adds is based on the name you pass to `jQuery.widget`, without the namespace; in our case "progressbar". The options passed to our plugin are the values that get set in `this.options` inside of our plugin instance. As shown below, we can specify default values for any of our options. When designing your API, you should figure out the most common use case for your plugin so that you can set appropriate default values and make all options truly optional.
+When we call `jQuery.widget()` it extends jQuery by adding a function to `jQuery.fn` (the system for creating a standard plugin). The name of the function it adds is based on the name you pass to `jQuery.widget()`, without the namespace - in our case "progressbar". The options passed to our plugin are the values that get set in `this.options` inside of our plugin instance. As shown below, we can specify default values for any of our options. When designing your API, you should figure out the most common use case for your plugin so that you can set appropriate default values and make all options truly optional.
```
$.widget( "custom.progressbar", {
+
// Default options.
options: {
value: 0
@@ -43,7 +46,7 @@ $.widget( "custom.progressbar", {
### Calling Plugin Methods
-Now that we can initialize our progress bar, we'll add the ability to perform actions by calling methods on our plugin instance. To define a plugin method, we just include the function in the object literal that we pass to `jQuery.widget`. We can also define "private" methods by prepending an underscore to the function name.
+Now that we can initialize our progress bar, we'll add the ability to perform actions by calling methods on our plugin instance. To define a plugin method, we just include the function in the object literal that we pass to `jQuery.widget()`. We can also define "private" methods by prepending an underscore to the function name.
```
$.widget( "custom.progressbar", {
@@ -61,6 +64,7 @@ $.widget( "custom.progressbar", {
// Create a public method.
value: function( value ) {
+
// No value passed, act as a getter.
if ( value === undefined ) {
return this.options.value;
@@ -106,7 +110,7 @@ alert( bar.progressbar( "value" ) );
### Working with Options
-One of the methods that are automatically available to our plugin is the `option` method. The `option` method allows you to get and set options after initialization. This method works exactly like jQuery's `.css()` and `.attr()` methods: You can pass just a name to use it as a getter, a name and value to use it as a single setter, or a hash of name/value pairs to set multiple values. When used as a getter, the plugin will return the current value of the option that corresponds to the name that was passed in. When used as a setter, the plugin's `_setOption` method will be called for each option that is being set. We can specify a `_setOption` method in our plugin to react to option changes. For actions to perform independent of the number of options changed, we can override `_setOptions`.
+One of the methods that are automatically available to our plugin is the `option()` method. The `option()` method allows you to get and set options after initialization. This method works exactly like jQuery's `.css()` and `.attr()` methods: You can pass just a name to use it as a getter, a name and value to use it as a single setter, or a hash of name/value pairs to set multiple values. When used as a getter, the plugin will return the current value of the option that corresponds to the name that was passed in. When used as a setter, the plugin's `_setOption` method will be called for each option that is being set. We can specify a `_setOption` method in our plugin to react to option changes. For actions to perform independent of the number of options changed, we can override `_setOptions`.
```
$.widget( "custom.progressbar", {
@@ -145,7 +149,7 @@ $.widget( "custom.progressbar", {
### Adding Callbacks
-One of the easiest ways to make your plugin extensible is to add callbacks so users can react when the state of your plugin changes. We can see below how to add a callback to our progress bar to signify when the progress has reached 100%. The `_trigger` method takes three parameters: the name of the callback, a jQuery event object that initiated the callback, and a hash of data relevant to the event. The callback name is the only required parameter, but the others can be very useful for users who want to implement custom functionality on top of your plugin. For example, if we were building a draggable plugin, we could pass the mousemove event when triggering a drag callback; this would allow users to react to the drag based on the x/y coordinates provided by the event object. Note that the original event passed to `_trigger` must be a jQuery event, not a native browser event.
+One of the easiest ways to make your plugin extensible is to add callbacks so users can react when the state of your plugin changes. We can see below how to add a callback to our progress bar to signify when the progress has reached 100%. The `_trigger()` method takes three parameters: the name of the callback, a jQuery event object that initiated the callback, and a hash of data relevant to the event. The callback name is the only required parameter, but the others can be very useful for users who want to implement custom functionality on top of your plugin. For example, if we were building a draggable plugin, we could pass the mousemove event when triggering a drag callback; this would allow users to react to the drag based on the x/y coordinates provided by the event object. Note that the original event passed to `_trigger()` must be a jQuery event, not a native browser event.
```
$.widget( "custom.progressbar", {
@@ -185,7 +189,7 @@ $.widget( "custom.progressbar", {
});
```
-Callback functions are essentially just additional options, so you can get and set them just like any other option. Whenever a callback is executed, a corresponding event is triggered as well. The event type is determined by concatenating the plugin name and the callback name. The callback and event both receive the same two parameters: an event object and a hash of data relevant to the event, as we'll see below. Your plugin may have functionality that you want to allow the user to prevent. The best way to support this is by creating cancelable callbacks. Users can cancel a callback, or its associated event, the same way they cancel any native event, by calling `event.preventDefault()` or returning `false`. If the user cancels the callback, the `_trigger` method will return `false` so you can implement the appropriate functionality within your plugin.
+Callback functions are essentially just additional options, so you can get and set them just like any other option. Whenever a callback is executed, a corresponding event is triggered as well. The event type is determined by concatenating the plugin name and the callback name. The callback and event both receive the same two parameters: an event object and a hash of data relevant to the event, as we'll see below. Your plugin may have functionality that you want to allow the user to prevent. The best way to support this is by creating cancelable callbacks. Users can cancel a callback, or its associated event, the same way they cancel any native event, by calling `event.preventDefault()` or returning `false`. If the user cancels the callback, the `_trigger()` method will return `false` so you can implement the appropriate functionality within your plugin.
```
var bar = $( "" )
@@ -205,7 +209,7 @@ bar.progressbar( "option", "value", 100 );
## Looking Under the Hood
-Now that we've seen how to build a plugin using the widget factory, let's take a look at how it actually works. When you call `jQuery.widget`, it creates a constructor for your plugin and sets the object literal that you pass in as the prototype for your plugin instances. All of the functionality that automatically gets added to your plugin comes from a base widget prototype, which is defined as `jQuery.Widget.prototype`. When a plugin instance is created, it is stored on the original DOM element using `jQuery.data`, with the plugin name as the key.
+Now that we've seen how to build a plugin using the widget factory, let's take a look at how it actually works. When you call `jQuery.widget()`, it creates a constructor for your plugin and sets the object literal that you pass in as the prototype for your plugin instances. All of the functionality that automatically gets added to your plugin comes from a base widget prototype, which is defined as `jQuery.Widget.prototype`. When a plugin instance is created, it is stored on the original DOM element using `jQuery.data`, with the plugin name as the key.
Because the plugin instance is directly linked to the DOM element, you can access the plugin instance directly instead of going through the exposed plugin method if you want. This will allow you to call methods directly on the plugin instance instead of passing method names as strings and will also give you direct access to the plugin's properties.
@@ -241,9 +245,11 @@ $.custom.progressbar.prototype.reset = function() {
};
```
+For more information on extending widgets, including how to build entirely new widgets on top of existing ones, see [Extending Widgets with the Widget Factory](/jquery-ui/widget-factory/extending-widgets/).
+
### Cleaning Up
-In some cases, it will make sense to allow users to apply and then later unapply your plugin. You can accomplish this via the `_destroy` method. Within the `_destroy` method, you should undo anything your plugin may have done during initialization or later use. `_destroy` is called by the `.destroy()` method, which is automatically called if the element that your plugin instance is tied to is removed from the DOM, so this can be used for garbage collection as well. That base `.destroy()` method also handles some general cleanup operations, like removing the instance reference from the widget's DOM element, unbinding all events in the widget's namespace from the element, and unbinding generally all events that were added using `_bind`.
+In some cases, it will make sense to allow users to apply and then later unapply your plugin. You can accomplish this via the `_destroy()` method. Within the `_destroy()` method, you should undo anything your plugin may have done during initialization or later use. `_destroy()` is called by the `.destroy()` method, which is automatically called if the element that your plugin instance is tied to is removed from the DOM, so this can be used for garbage collection as well. That base `.destroy()` method also handles some general cleanup operations, like removing the instance reference from the widget's DOM element, unbinding all events in the widget's namespace from the element, and unbinding generally all events that were added using `_bind()`.
```
$.widget( "custom.progressbar", {
From 8cc59c295bc1bf2d05c24b67d1b471164c7c69f5 Mon Sep 17 00:00:00 2001
From: TJ VanToll
Date: Sat, 21 Sep 2013 20:18:32 -0400
Subject: [PATCH 005/331] Clarify that many of the widget methods return
undefined through instance invocation.
---
.../widget-factory/widget-method-invocation.md | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/page/jquery-ui/widget-factory/widget-method-invocation.md b/page/jquery-ui/widget-factory/widget-method-invocation.md
index 9ec783d4..91e9986b 100644
--- a/page/jquery-ui/widget-factory/widget-method-invocation.md
+++ b/page/jquery-ui/widget-factory/widget-method-invocation.md
@@ -23,7 +23,7 @@ This returns the value of the [dialog's `height` option](http://api.jqueryui.com
### Instance Invocation
-Under the hoods, every instance of every widget is stored on the element using [`jQuery.data()`](http://api.jquery.com/jQuery.data/). To retrieve the instance object, call `jQuery.data()` using the widget's full name as the key. Let's look at each.
+Under the hoods, every instance of every widget is stored on the element using [`jQuery.data()`](http://api.jquery.com/jQuery.data/). To retrieve the instance object, call `jQuery.data()` using the widget's full name as the key. This is shown below.
```
var dialog = $( ".selector" ).data( "ui-dialog" );
@@ -44,11 +44,20 @@ $( ".selector" ).dialog( "instance" ).close();
### Return Types
-Most methods invoked through the widget's plugin will return a `jQuery` object so the method call can be chained with additional jQuery methods.
+Most methods invoked through the widget's plugin will return a `jQuery` object so the method call can be chained with additional jQuery methods. This is even true of methods that return `undefined` when invoked on the instance. This is shown in the example below.
```
-$( ".selector" )
- .dialog( "close" )
+var dialog = $( ".selector" ).dialog();
+
+// Instance invocation - returns undefined
+dialog.data( "ui-dialog" ).close();
+
+// Plugin invocation - returns a jQuery object
+dialog.dialog( "close" );
+
+// Therefore, plugin method invocation makes it possible to
+// chain method calls with other jQuery functions
+dialog.dialog( "close" )
.css( "color", "red" );
```
From 54946db1e37164f5f4154f6bded0236abbe6655c Mon Sep 17 00:00:00 2001
From: "John K. Paul"
Date: Sat, 24 Aug 2013 16:11:21 -0400
Subject: [PATCH 006/331] Fixes #395, update index article with indended and
1.9+ behavior.
---
page/using-jquery-core/understanding-index.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/page/using-jquery-core/understanding-index.md b/page/using-jquery-core/understanding-index.md
index 823c8f04..a2b490a3 100644
--- a/page/using-jquery-core/understanding-index.md
+++ b/page/using-jquery-core/understanding-index.md
@@ -26,20 +26,20 @@ console.log( "Index: " + $foo.index() ); // 1
var $listItem = $( "li" );
-// This implicitly calls .last()
-console.log( "Index: " + $listItem.index() ); // 3
-console.log( "Index: " + $listItem.last().index() ); // 3
+// This implicitly calls .first()
+console.log( "Index: " + $listItem.index() ); // 1
+console.log( "Index: " + $listItem.first().index() ); // 1
var $div = $( "div" );
-// This implicitly calls .last()
-console.log( "Index: " + $div.index() ); // 4
-console.log( "Index: " + $div.last().index() ); // 4
+// This implicitly calls .first()
+console.log( "Index: " + $div.index() ); // 0
+console.log( "Index: " + $div.first().index() ); // 0
```
In the first example, `.index()` gives the zero-based index of `#foo1` within its parent. Since `#foo1` is the second child of its parent, `index()` returns 1.
-Potential confusion comes from the other examples of `.index()` in the above code. When `.index()` is called on a jQuery object that contains more than one element, it does not calculate the index of the first element as might be expected, but instead calculates the index of the last element. This is equivalent to always calling `$jqObject.last().index();`.
+When `.index()` is called on a jQuery object that contains more than one element, it calculates the index of the first element.
## `.index()` with a String Argument
From a9711df214b4aeef15708862a52b89369248faba Mon Sep 17 00:00:00 2001
From: "Eddie Monge Jr."
Date: Thu, 24 Oct 2013 12:44:09 -0700
Subject: [PATCH 007/331] Add comments explaining switch block
---
page/javascript-101/conditional-code.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/page/javascript-101/conditional-code.md b/page/javascript-101/conditional-code.md
index 9edd246e..5b606ef3 100644
--- a/page/javascript-101/conditional-code.md
+++ b/page/javascript-101/conditional-code.md
@@ -115,12 +115,13 @@ var stuffToDo = {
};
+// Check if the property exists in the object.
if ( stuffToDo[ foo ] ) {
-
+ // This code won't run.
stuffToDo[ foo ]();
} else {
-
+ // This code will run.
stuffToDo[ "default" ]();
}
From 7992ab20ed3b1f8350dd9bb8878dbe5d693c5b42 Mon Sep 17 00:00:00 2001
From: Harshad Sabne
Date: Sun, 22 Sep 2013 12:26:52 +0530
Subject: [PATCH 008/331] Update advanced-plugin-concepts.md
Code style adherence
---
page/plugins/advanced-plugin-concepts.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/plugins/advanced-plugin-concepts.md b/page/plugins/advanced-plugin-concepts.md
index 6181a402..8dbec188 100644
--- a/page/plugins/advanced-plugin-concepts.md
+++ b/page/plugins/advanced-plugin-concepts.md
@@ -252,7 +252,7 @@ var $wrapper = $( "" )
$wrapper.append( "..." ); // Easy to reference later...
```
-Notice that we've created a reference to the injected wrapper and we're also calling the ´.attr()` method to add any specified attributes to the element. So, in our settings it might be handled like this:
+Notice that we've created a reference to the injected wrapper and we're also calling the `.attr()` method to add any specified attributes to the element. So, in our settings it might be handled like this:
```
var defaults = {
From b75be5436900a95cbd654750c95b9f47df6f4060 Mon Sep 17 00:00:00 2001
From: Corey Frang
Date: Sat, 26 Oct 2013 12:14:18 -0400
Subject: [PATCH 009/331] 0.3.1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 84b397af..79f59d61 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.0",
+ "version": "0.3.1",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 5d1c680aecd36bef4ec03edb47371403d8802ef6 Mon Sep 17 00:00:00 2001
From: Corey Frang
Date: Sat, 26 Oct 2013 12:14:49 -0400
Subject: [PATCH 010/331] 0.3.2
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 79f59d61..55406948 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.1",
+ "version": "0.3.2",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From c18f209e18bb462907845cda6c2605e141c0f096 Mon Sep 17 00:00:00 2001
From: Patrick Costa
Date: Thu, 31 Oct 2013 03:51:42 -0300
Subject: [PATCH 011/331] Add event-basics and event-helpers to order.yml.
Fixes #437.
---
order.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/order.yml b/order.yml
index 19009411..511ffee2 100644
--- a/order.yml
+++ b/order.yml
@@ -48,6 +48,8 @@
- how-do-i-replace-text-from-the-3rd-element-of-a-list-of-10-items
- how-do-i-pull-a-native-dom-element-from-a-jquery-object
- events:
+ - event-basics
+ - event-helpers
- introduction-to-events
- handling-events
- inside-event-handling-function
From 8a64fa073083aefcd0f71817a64bd0ca930b1fd0 Mon Sep 17 00:00:00 2001
From: Christian David Ospina Caicedo
Date: Sat, 26 Oct 2013 13:46:31 -0500
Subject: [PATCH 012/331] Removing a bracket
There is a bracket that was not open
---
page/effects/custom-effects.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/effects/custom-effects.md b/page/effects/custom-effects.md
index cd8d6360..21c2b096 100644
--- a/page/effects/custom-effects.md
+++ b/page/effects/custom-effects.md
@@ -19,7 +19,7 @@ $( "div.funtimes" ).animate({
function() { // Callback when the animation is finished
console.log( "done!" );
}
-});
+);
```
**Note:** Color-related properties cannot be animated with `.animate()` using jQuery
From e4b87bb453acf17caa7b7032132a7f20ddf3e4f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Oubi=C3=B1a?=
Date: Mon, 4 Nov 2013 20:26:25 +0100
Subject: [PATCH 013/331] Typo: this will be set instead of `this` will be set
---
page/javascript-101/this-keyword.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/javascript-101/this-keyword.md b/page/javascript-101/this-keyword.md
index 7ce95be3..53be72ba 100644
--- a/page/javascript-101/this-keyword.md
+++ b/page/javascript-101/this-keyword.md
@@ -8,7 +8,7 @@ attribution:
In JavaScript, as in most object-oriented programming languages, `this` is a special keyword that is used in methods to refer to the object on which a method is being invoked. The value of `this` is determined using a simple series of steps:
-- If the function is invoked using `Function.call()` or `Function.apply()`, this will be set to the first argument passed to `.call()`/`.apply()`. If the first argument passed to `.call()`/`.apply()` is `null` or `undefined`, `this` will refer to the global object (which is the `window` object in web browsers).
+- If the function is invoked using `Function.call()` or `Function.apply()`, `this` will be set to the first argument passed to `.call()`/`.apply()`. If the first argument passed to `.call()`/`.apply()` is `null` or `undefined`, `this` will refer to the global object (which is the `window` object in web browsers).
- If the function being invoked was created using `Function.bind()`, `this` will be the first argument that was passed to `.bind()` at the time the function was created.
- If the function is being invoked as a method of an object, `this` will refer to that object.
- Otherwise, the function is being invoked as a standalone function not attached to any object, and `this` will refer to the global object.
From 719066289326e5e366e0bec1c942f232e8f766c1 Mon Sep 17 00:00:00 2001
From: Ilya Vorontsov
Date: Thu, 26 Sep 2013 01:57:12 +0400
Subject: [PATCH 014/331] fix typo
---
page/javascript-101/loops.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/page/javascript-101/loops.md b/page/javascript-101/loops.md
index 8d3883fa..ba56987c 100644
--- a/page/javascript-101/loops.md
+++ b/page/javascript-101/loops.md
@@ -22,14 +22,14 @@ Note that in loops, the variable `i` is not "scoped" to the loop block even thou
A `for` loop is made up of four statements and has the following structure:
```
-for ( [initialisation]; [conditional]; [iteration] ) {
+for ( [initialization]; [conditional]; [iteration] ) {
[loopBody]
}
```
-The _initialisation_ statement is executed only once, before the loop starts. It gives you an opportunity to prepare or declare any variables.
+The _initialization_ statement is executed only once, before the loop starts. It gives you an opportunity to prepare or declare any variables.
The _conditional_ statement is executed before each iteration, and its return value decides whether the loop is to continue. If the conditional statement evaluates to a falsy value, then the loop stops.
From c8054c56d946061d7589e5422f1ed43497999559 Mon Sep 17 00:00:00 2001
From: Robert Marton
Date: Fri, 12 Apr 2013 09:54:13 +0300
Subject: [PATCH 015/331] Update history-of-events.md
---
page/events/history-of-events.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/page/events/history-of-events.md b/page/events/history-of-events.md
index b6064b38..3a5abb41 100644
--- a/page/events/history-of-events.md
+++ b/page/events/history-of-events.md
@@ -25,6 +25,7 @@ It is possible to use `.bind()` and attach a handler to every element.
```
$( "#list li" ).bind( "click", function( event ) {
+ var $elem = $( event.target );
console.log( $elem.text() );
});
```
From 37f7ae551c99422699b0324b33324332fbc1f6bb Mon Sep 17 00:00:00 2001
From: Eugen Istoc
Date: Tue, 30 Jul 2013 00:39:29 -0400
Subject: [PATCH 016/331] Typo: Change "brackets" to "parentheses"
---
page/plugins/basic-plugin-creation.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/plugins/basic-plugin-creation.md b/page/plugins/basic-plugin-creation.md
index a872ece4..1490ce0e 100644
--- a/page/plugins/basic-plugin-creation.md
+++ b/page/plugins/basic-plugin-creation.md
@@ -199,7 +199,7 @@ Here's an example of a small plugin using some of the techniques we've discussed
$( "a" ).showLinkLocation();
```
-This handy plugin goes through all anchors in the collection and appends the `href` attribute in brackets.
+This handy plugin goes through all anchors in the collection and appends the `href` attribute in parentheses.
```
From 03763595ffb456d2ed56fcf395b7ba76a60626e4 Mon Sep 17 00:00:00 2001
From: "Mark Anthony B. Dungo"
Date: Tue, 17 Sep 2013 16:09:53 +0800
Subject: [PATCH 017/331] Fixed parameter order for insertBefore() example.
---
page/using-jquery-core/jquery-object.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/using-jquery-core/jquery-object.md b/page/using-jquery-core/jquery-object.md
index e8366353..be6980b1 100644
--- a/page/using-jquery-core/jquery-object.md
+++ b/page/using-jquery-core/jquery-object.md
@@ -42,7 +42,7 @@ var target = document.getElementById( "target" );
var newElement = document.createElement( "div" );
-target.parentNode.insertBefore( target.nextSibling, newElement )
+target.parentNode.insertBefore( newElement, target.nextSibling )
```
By wrapping the `target` element in a jQuery object, the same task becomes much simpler:
From bc773be32f4a145f142559299c5d7bc76ff237b0 Mon Sep 17 00:00:00 2001
From: Benjamin Warren
Date: Tue, 3 Sep 2013 20:08:57 +1000
Subject: [PATCH 018/331] Append Outside Loop: Grammar and spelling
corrections.
---
page/performance/append-outside-loop.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/page/performance/append-outside-loop.md b/page/performance/append-outside-loop.md
index 180823b4..1831d770 100644
--- a/page/performance/append-outside-loop.md
+++ b/page/performance/append-outside-loop.md
@@ -6,7 +6,7 @@ attribution:
- jQuery Fundamentals
---
-Touching the DOM comes at a cost; if you're appending a lot of elements to the DOM, you will want to append them all at once, rather then one at a time. This is common problem when appending elements within a loop.
+Touching the DOM comes at a cost. If you're appending a lot of elements to the DOM, you will want to append them all at once, rather than one at a time. This is a common problem when appending elements within a loop.
```
$.each( myArray, function( i, item ) {
@@ -37,7 +37,7 @@ $.each( myArray, function( i, item ) {
$( "#ballers" )[ 0 ].appendChild( frag );
```
-Another technique, which is quite simple, is to build up a string during each iteration of the loop. After the loop, just set the HTML of the DOM element to that string.
+Another simple technique is to build up a string during each iteration of the loop. After the loop, just set the HTML of the DOM element to that string.
```
var myHtml = "";
@@ -51,4 +51,4 @@ $.each( myArray, function( i, item ) {
$( "#ballers" ).html( myHtml );
```
-There are of course other techniques you could certainly test out; a great way to test the performance of these is through a site called [jsperf](http://jsperf.com). This site allows you to benchmark each technique and visually see how it performs across all the browsers.
+There are of course other techniques you could certainly test out. A great way to test the performance of these is through a site called [jsperf](http://jsperf.com). This site allows you to benchmark each technique and visually see how it performs across all the browsers.
From e8b528cf04a85c2f112e48130b59fcad63979e47 Mon Sep 17 00:00:00 2001
From: Vipul Amler
Date: Sat, 30 Nov 2013 11:52:09 +0530
Subject: [PATCH 019/331] Fix some typos.
Closes gh-442
---
page/javascript-101/scope.md | 2 +-
page/jquery-ui/getting-started.md | 2 +-
page/jquery-ui/how-jquery-ui-works.md | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/page/javascript-101/scope.md b/page/javascript-101/scope.md
index e1069e76..3a817482 100644
--- a/page/javascript-101/scope.md
+++ b/page/javascript-101/scope.md
@@ -36,7 +36,7 @@ Since `x` was initialized within `.myFunc()`, it is only accessible within `.myF
## A Word of Caution
-If you declare a variable and forget to use the `var` keyword, that variable is automically made global. So this code would work:
+If you declare a variable and forget to use the `var` keyword, that variable is automatically made global. So this code would work:
```
function myFunc() {
diff --git a/page/jquery-ui/getting-started.md b/page/jquery-ui/getting-started.md
index 84794ef2..408375a7 100644
--- a/page/jquery-ui/getting-started.md
+++ b/page/jquery-ui/getting-started.md
@@ -19,7 +19,7 @@ Once you have a basic understanding of what jQuery UI is and what it does, you'r
#### Step 1: Choose Which Components You Need
-The main column of the Download Builder lists all of the JavaScript components in jQuery UI categorized into groups: core, interations, widgets, and effects. Some components in jQuery UI depend on other components. Just check the boxes for the widgets you'd like to download and any required dependencies will automatically be checked as well. The components you select will all be combined into a custom jQuery UI JavaScript file.
+The main column of the Download Builder lists all of the JavaScript components in jQuery UI categorized into groups: core, interactions, widgets, and effects. Some components in jQuery UI depend on other components. Just check the boxes for the widgets you'd like to download and any required dependencies will automatically be checked as well. The components you select will all be combined into a custom jQuery UI JavaScript file.

diff --git a/page/jquery-ui/how-jquery-ui-works.md b/page/jquery-ui/how-jquery-ui-works.md
index 938aa72a..f69abcc1 100644
--- a/page/jquery-ui/how-jquery-ui-works.md
+++ b/page/jquery-ui/how-jquery-ui-works.md
@@ -7,7 +7,7 @@ jQuery UI contains many widgets that maintain [state](http://en.wikipedia.org/wi
## Initialization
-In order to track the state of the widget, we must introduce a full life cycle for the widget. The life cycle starts when the widget is initalized. To initialize a widget, we simply call the plugin on one or more elements.
+In order to track the state of the widget, we must introduce a full life cycle for the widget. The life cycle starts when the widget is initialized. To initialize a widget, we simply call the plugin on one or more elements.
```
$( "#elem" ).progressbar();
From d8973e38bcab3e72a6727529c81b5f2bd5b1d9c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Tue, 3 Dec 2013 07:51:57 -0500
Subject: [PATCH 020/331] 0.3.3
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 55406948..4fdb6d00 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.2",
+ "version": "0.3.3",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 5cef15f315fac088a3cfc2525bebbbc768232e93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Mon, 6 Jan 2014 14:43:24 -0500
Subject: [PATCH 021/331] Build: Upgrade to grunt-jquery-content 0.11.1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 4fdb6d00..c586d301 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"grunt-clean": "0.3.0",
"grunt-html": "0.1.1",
"grunt-wordpress": "1.0.7",
- "grunt-jquery-content": "0.9.0",
+ "grunt-jquery-content": "0.11.1",
"grunt-check-modules": "0.1.0",
"js-yaml": "2.0.1"
}
From ba4f58656c6f0de08187a80c0d16348288fc3ec7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Mon, 6 Jan 2014 14:43:45 -0500
Subject: [PATCH 022/331] 0.3.4
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index c586d301..135c7d14 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.3",
+ "version": "0.3.4",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From b88d135f921d0a812371dba7e48bb05f9cb3e8d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Wed, 8 Jan 2014 18:04:12 -0500
Subject: [PATCH 023/331] Advanced Plugin Concepts: Changed "Firebug console"
to "console"
Closes gh-453
---
page/plugins/advanced-plugin-concepts.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/plugins/advanced-plugin-concepts.md b/page/plugins/advanced-plugin-concepts.md
index 8dbec188..4d736479 100644
--- a/page/plugins/advanced-plugin-concepts.md
+++ b/page/plugins/advanced-plugin-concepts.md
@@ -110,7 +110,7 @@ This technique makes it possible for others to define and ship transition defini
The technique of exposing part of your plugin to be overridden can be very powerful. But you need to think carefully about what parts of your implementation to expose. Once it's exposed, you need to keep in mind that any changes to the calling arguments or semantics may break backward compatibility. As a general rule, if you're not sure whether to expose a particular function, then you probably shouldn't.
-So how then do we define more functions without cluttering the namespace and without exposing the implementation? This is a job for closures. To demonstrate, we'll add another function to our plugin called "debug". The debug function will log the number of selected elements to the Firebug console. To create a closure, we wrap the entire plugin definition in a function (as detailed in the jQuery Authoring Guidelines).
+So how then do we define more functions without cluttering the namespace and without exposing the implementation? This is a job for closures. To demonstrate, we'll add another function to our plugin called "debug". The debug function will log the number of selected elements to the console. To create a closure, we wrap the entire plugin definition in a function (as detailed in the jQuery Authoring Guidelines).
```
// Create closure.
From c99484286c36327c45be77f1e59a7b157ec0cec3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Wed, 8 Jan 2014 18:07:06 -0500
Subject: [PATCH 024/331] 0.3.5
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 135c7d14..b8081066 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.4",
+ "version": "0.3.5",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 48242d8e16b836176594b949612d0f2dbceb8937 Mon Sep 17 00:00:00 2001
From: Ahmed Abdel Razzak
Date: Thu, 9 Jan 2014 14:05:47 +0200
Subject: [PATCH 025/331] Widget Factory: Fix rendering negative progressbar
value
Closes gh-454
---
page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md b/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md
index fe3b175f..5bde8210 100644
--- a/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md
+++ b/page/jquery-ui/widget-factory/how-to-use-the-widget-factory.md
@@ -118,6 +118,7 @@ $.widget( "custom.progressbar", {
value: 0
},
_create: function() {
+ this.options.value = this._constrain(this.options.value);
this.element.addClass( "progressbar" );
this.refresh();
},
@@ -157,6 +158,7 @@ $.widget( "custom.progressbar", {
value: 0
},
_create: function() {
+ this.options.value = this._constrain(this.options.value);
this.element.addClass( "progressbar" );
this.refresh();
},
@@ -257,6 +259,7 @@ $.widget( "custom.progressbar", {
value: 0
},
_create: function() {
+ this.options.value = this._constrain(this.options.value);
this.element.addClass( "progressbar" );
this.refresh();
},
From 88ddf8eb199691bc3aa098e30b29f74480f70f42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 9 Jan 2014 08:17:29 -0500
Subject: [PATCH 026/331] 0.3.6
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index b8081066..f9c99ee9 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.5",
+ "version": "0.3.6",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 8dbc4e6d09ffe0241635f3b201ec43f96087255b Mon Sep 17 00:00:00 2001
From: Giustino Borzacchiello
Date: Mon, 13 Jan 2014 16:08:59 +0100
Subject: [PATCH 027/331] Basic Plugin Creation: Added missing word 'to'
Closes gh-455
---
page/plugins/basic-plugin-creation.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/plugins/basic-plugin-creation.md b/page/plugins/basic-plugin-creation.md
index 1490ce0e..0e9fe473 100644
--- a/page/plugins/basic-plugin-creation.md
+++ b/page/plugins/basic-plugin-creation.md
@@ -143,7 +143,7 @@ Notice that we return the results of `.each()` instead of returning `this`. Sinc
## Accepting Options
-As your plugins get more and more complex, it's a good idea to make your plugin customizable by accepting options. The easiest way do this, especially if there are lots of options, is with an object literal. Let's change our greenify plugin to accept some options.
+As your plugins get more and more complex, it's a good idea to make your plugin customizable by accepting options. The easiest way to do this, especially if there are lots of options, is with an object literal. Let's change our greenify plugin to accept some options.
```
(function ( $ ) {
From 2d9e3dba5015cdeb890028ad482f67bfc147af07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Mon, 13 Jan 2014 10:39:05 -0500
Subject: [PATCH 028/331] 0.3.7
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index f9c99ee9..8c99745c 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.6",
+ "version": "0.3.7",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 395fc580a9c2dfb987ec685174902727ec227b4a Mon Sep 17 00:00:00 2001
From: Tyler Cipriani
Date: Tue, 14 Jan 2014 09:53:03 -0700
Subject: [PATCH 029/331] Widget Factory: Fix typo (setter -> getter)
Closes gh-456
---
page/plugins/stateful-plugins-with-widget-factory.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/plugins/stateful-plugins-with-widget-factory.md b/page/plugins/stateful-plugins-with-widget-factory.md
index 66bc26b6..e3e2e3ef 100644
--- a/page/plugins/stateful-plugins-with-widget-factory.md
+++ b/page/plugins/stateful-plugins-with-widget-factory.md
@@ -140,7 +140,7 @@ alert( bar.progressbar( "value" ) );
### Working with Widget Options
-One of the methods that is automatically available to our plugin is the option method. The option method allows you to get and set options after initialization. This method works exactly like jQuery's `.css()` and `.attr()` methods: you can pass just a name to use it as a setter, a name and value to use it as a single setter, or a hash of name/value pairs to set multiple values. When used as a getter, the plugin will return the current value of the option that corresponds to the name that was passed in. When used as a setter, the plugin's `_setOption` method will be called for each option that is being set. We can specify a `_setOption` method in our plugin to react to option changes.
+One of the methods that is automatically available to our plugin is the option method. The option method allows you to get and set options after initialization. This method works exactly like jQuery's `.css()` and `.attr()` methods: you can pass just a name to use it as a getter, a name and value to use it as a single setter, or a hash of name/value pairs to set multiple values. When used as a getter, the plugin will return the current value of the option that corresponds to the name that was passed in. When used as a setter, the plugin's `_setOption` method will be called for each option that is being set. We can specify a `_setOption` method in our plugin to react to option changes.
Responding when an option is set:
From e29eac42d4381acbf047699085ce5f2f7078b52a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Tue, 14 Jan 2014 13:07:17 -0500
Subject: [PATCH 030/331] 0.3.8
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 8c99745c..5eb6a29d 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.7",
+ "version": "0.3.8",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 13436e466acbfc90f1fd0106ba35e8b6b9e9dfc4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Sat, 8 Feb 2014 10:03:18 -0500
Subject: [PATCH 031/331] ThemeRoller: Fixed image references
Fixes gh-466
---
page/jquery-ui/theming/themeroller.md | 8 ++++----
..._gallery_new.png => themeroller-gallery-new.png} | Bin
...erface_new.png => themeroller-interface-new.png} | Bin
..._200px.png => themeroller-ready-black-200px.png} | Bin
..._200px.png => themeroller-ready-white-200px.png} | Bin
5 files changed, 4 insertions(+), 4 deletions(-)
rename resources/jquery-ui/{Themeroller_gallery_new.png => themeroller-gallery-new.png} (100%)
rename resources/jquery-ui/{Themeroller_interface_new.png => themeroller-interface-new.png} (100%)
rename resources/jquery-ui/{Themeroller_ready_black_200px.png => themeroller-ready-black-200px.png} (100%)
rename resources/jquery-ui/{Themeroller_ready_white_200px.png => themeroller-ready-white-200px.png} (100%)
diff --git a/page/jquery-ui/theming/themeroller.md b/page/jquery-ui/theming/themeroller.md
index 231389b1..c223f4e2 100644
--- a/page/jquery-ui/theming/themeroller.md
+++ b/page/jquery-ui/theming/themeroller.md
@@ -8,8 +8,8 @@ level: beginner
ThemeRoller is a web app that offers a fun and intuitive interface for designing and downloading custom themes for jQuery UI. You can find ThemeRoller in the "Themes" section of the jQuery UI site, or by following this link: [jQuery UI ThemeRoller](http://jqueryui.com/themeroller)
-
-
+
+
### The ThemeRoller Interface
@@ -30,8 +30,8 @@ Your theme will include images and CSS that make up a customized version of the
Once the theme has been downloaded and unzipped, you will see a folder named `themes`. This folder contains the CSS and images needed for your theme. Copy the theme directory into your project and link to the `themes/all.css` file from your pages.
### Building Custom "ThemeRoller-Ready" Components
-
-
+
+
ThemeRoller generates a customized version of the jQuery UI CSS Framework for developing your own ThemeRoller-ready jQuery components. The classes generated by this framework are designed to accommodate common user interface design situations and include states, icons, and various helper classes as well.
diff --git a/resources/jquery-ui/Themeroller_gallery_new.png b/resources/jquery-ui/themeroller-gallery-new.png
similarity index 100%
rename from resources/jquery-ui/Themeroller_gallery_new.png
rename to resources/jquery-ui/themeroller-gallery-new.png
diff --git a/resources/jquery-ui/Themeroller_interface_new.png b/resources/jquery-ui/themeroller-interface-new.png
similarity index 100%
rename from resources/jquery-ui/Themeroller_interface_new.png
rename to resources/jquery-ui/themeroller-interface-new.png
diff --git a/resources/jquery-ui/Themeroller_ready_black_200px.png b/resources/jquery-ui/themeroller-ready-black-200px.png
similarity index 100%
rename from resources/jquery-ui/Themeroller_ready_black_200px.png
rename to resources/jquery-ui/themeroller-ready-black-200px.png
diff --git a/resources/jquery-ui/Themeroller_ready_white_200px.png b/resources/jquery-ui/themeroller-ready-white-200px.png
similarity index 100%
rename from resources/jquery-ui/Themeroller_ready_white_200px.png
rename to resources/jquery-ui/themeroller-ready-white-200px.png
From 04e8965528b9dbc3c3cb842f299376cf3a3c1ae8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Sat, 8 Feb 2014 10:05:01 -0500
Subject: [PATCH 032/331] 0.3.9
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 5eb6a29d..db3853e0 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.8",
+ "version": "0.3.9",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 1acb22cef75699fc709fd1b5510668a00417eec3 Mon Sep 17 00:00:00 2001
From: Spencer Rogers
Date: Tue, 1 Apr 2014 14:00:22 -0400
Subject: [PATCH 033/331] Understanding Index: Fix typo
Fixes gh-471
Closes gh-485
---
page/using-jquery-core/understanding-index.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/using-jquery-core/understanding-index.md b/page/using-jquery-core/understanding-index.md
index a2b490a3..1b77a515 100644
--- a/page/using-jquery-core/understanding-index.md
+++ b/page/using-jquery-core/understanding-index.md
@@ -71,7 +71,7 @@ var $div = $( "#last" );
console.log( "Index: " + $div.index( "div" ) ); // 2
```
-When `.index()` is called with a string argument, there are two things to consider. First, jQuery will implicitly call `.first()` on the original jQuery object. It will be find the index of the first element, not the last element in this case. This is inconsistent, so be careful here.
+When `.index()` is called with a string argument, there are two things to consider. First, jQuery will implicitly call `.first()` on the original jQuery object. It will find the index of the first element, not the last element in this case. This is inconsistent, so be careful here.
The second point to consider is that jQuery is querying the entire DOM using the passed in string selector and checking the index within that newly queried jQuery object. For example, when using `.index( "div" )` in the last example above, jQuery is selecting all of the `
` elements in the document, then searching for the index that contains the first element in the jQuery object `.index()` is called on.
From 3e910aa50843aee92dc74ea3fc42826c93ab8061 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 17:07:22 -0400
Subject: [PATCH 034/331] jQuery UI Getting Started: Remove line number
reference
Closes gh-484
---
page/jquery-ui/getting-started.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/jquery-ui/getting-started.md b/page/jquery-ui/getting-started.md
index 408375a7..a2c0fe25 100644
--- a/page/jquery-ui/getting-started.md
+++ b/page/jquery-ui/getting-started.md
@@ -119,7 +119,7 @@ ThemeRoller provides a custom interface for designing all of the elements used b
When you click the "Download theme" button in ThemeRoller, you'll be directed to the Download Builder and your custom theme will be auto-selected in the Theme dropdown menu. You can configure your download package further from there. Once you download, you'll see that the `example.html` page is styled using your custom theme.
-**Quick Tip:** *If you ever need to edit your theme, simply open the CSS file and find on line 43 where it says "To view and modify this theme, visit ..." That url will open the theme in ThemeRoller for editing.*
+**Quick Tip:** *If you ever need to edit your theme, simply open the CSS file and find where it says "To view and modify this theme, visit ..." That URL will open the theme in ThemeRoller for editing.*
### Support: Where Can I Get Help?
From 096ff6435b367f12ac68541c8627ecdfcac37e1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 17:12:40 -0400
Subject: [PATCH 035/331] Basic Plugin Creation: Cache jQuery object
Closes gh-482
---
page/plugins/basic-plugin-creation.md | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/page/plugins/basic-plugin-creation.md b/page/plugins/basic-plugin-creation.md
index 0e9fe473..0725f61d 100644
--- a/page/plugins/basic-plugin-creation.md
+++ b/page/plugins/basic-plugin-creation.md
@@ -188,15 +188,16 @@ Here's an example of a small plugin using some of the techniques we've discussed
$.fn.showLinkLocation = function() {
return this.filter( "a" ).each(function() {
- $( this ).append( " (" + $( this ).attr( "href" ) + ")" );
+ var link = $( this );
+ link.append( " (" + link.attr( "href" ) + ")" );
});
};
}( jQuery ));
- // Usage example:
- $( "a" ).showLinkLocation();
+// Usage example:
+$( "a" ).showLinkLocation();
```
This handy plugin goes through all anchors in the collection and appends the `href` attribute in parentheses.
From 261eb570ba34c11efd21e2b5f86dcff211500aa4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 17:16:00 -0400
Subject: [PATCH 036/331] Iterating: Fix typo
Closes gh-476
---
page/using-jquery-core/iterating.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/using-jquery-core/iterating.md b/page/using-jquery-core/iterating.md
index 4c73245c..9db4dd1c 100644
--- a/page/using-jquery-core/iterating.md
+++ b/page/using-jquery-core/iterating.md
@@ -209,7 +209,7 @@ $( "input" ).val(function( index, value ) {
```
-One other thing to keep in mind with this implicit iteration is that traversal methods such as `.children()` or `.parent()` will act on each matched element in a connection, returning a combined collection of all children or parent nodes.
+One other thing to keep in mind with this implicit iteration is that traversal methods such as `.children()` or `.parent()` will act on each matched element in a collection, returning a combined collection of all children or parent nodes.
### [`.map()`](http://api.jquery.com/map/)
From 8c6129f08e508e5cc1f44625661c272879c99d35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 17:31:50 -0400
Subject: [PATCH 037/331] Manipulating Elements: Fix typo
Closes gh-467
---
page/using-jquery-core/manipulating-elements.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/using-jquery-core/manipulating-elements.md b/page/using-jquery-core/manipulating-elements.md
index f49ae31e..328a18a0 100644
--- a/page/using-jquery-core/manipulating-elements.md
+++ b/page/using-jquery-core/manipulating-elements.md
@@ -34,7 +34,7 @@ While there are a variety of ways to move elements around the DOM, there are gen
* Place the selected element(s) relative to another element.
* Place an element relative to the selected element(s).
-For example, jQuery provides `.insertAfter()` and `.after()`. The `.insertAfter()` method places the selected element(s) after the element that provided as an argument. The `.after()` method places the element provided as an argument after the selected element. Several other methods follow this pattern: `.insertBefore()` and `.before()`, `.appendTo()` and `.append()`, and `.prependTo()` and `.prepend()`.
+For example, jQuery provides `.insertAfter()` and `.after()`. The `.insertAfter()` method places the selected element(s) after the element provided as an argument. The `.after()` method places the element provided as an argument after the selected element. Several other methods follow this pattern: `.insertBefore()` and `.before()`, `.appendTo()` and `.append()`, and `.prependTo()` and `.prepend()`.
The method that makes the most sense will depend on what elements are selected, and whether you need to store a reference to the elements you're adding to the page. If you need to store a reference, you will always want to take the first approach – placing the selected elements relative to another element – as it returns the element(s) you're placing. In this case, `.insertAfter()`, `.insertBefore()`, `.appendTo()`, and `.prependTo()` should be the tools of choice.
From d2ba9879f2c954d5c0881628ae354f4080b92704 Mon Sep 17 00:00:00 2001
From: Calvin Tam
Date: Wed, 5 Feb 2014 22:07:51 +1100
Subject: [PATCH 038/331] Event Basics: Fixed typo
Closes gh-465
---
page/events/event-basics.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/events/event-basics.md b/page/events/event-basics.md
index 5d9486af..035aace2 100644
--- a/page/events/event-basics.md
+++ b/page/events/event-basics.md
@@ -18,7 +18,7 @@ trigger the event.
jQuery offers convenience methods for most native browser events. These methods —
including `.click()`, `.focus()`, `.blur()`, `.change()`, etc. — are shorthand
for jQuery's `.on()` method. The on method is useful for binding the same handler
-function to multiple events, when you want to provide data to the event hander,
+function to multiple events, when you want to provide data to the event handler,
when you are working with custom events, or when you want to pass an object of
multiple events and handlers.
From b58906ff3cff8620333dcd786593eb9e1968d92e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 17:37:21 -0400
Subject: [PATCH 039/331] Getting Started: Fix reference to Firefox Developer
Tools
Closes gh-461
---
page/javascript-101/getting-started.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/javascript-101/getting-started.md b/page/javascript-101/getting-started.md
index 77fa6968..9c803c76 100644
--- a/page/javascript-101/getting-started.md
+++ b/page/javascript-101/getting-started.md
@@ -80,5 +80,5 @@ Commonly referred to as "developer tools," many browsers ship with built-in feat
- [Apple Safari](https://developer.apple.com/technologies/safari/developer-tools.html)
- [Google Chrome Developer Tools](https://developers.google.com/chrome-developer-tools/)
- [Microsoft Internet Explorer](http://msdn.microsoft.com/en-us/library/ie/gg589507.aspx)
-- [Mozilla Firefox Web Development Tools](https://developer.mozilla.org/en-US/docs/Tools)
+- [Mozilla Firefox Developer Tools](https://developer.mozilla.org/en-US/docs/Tools)
- [Opera Dragonfly](http://www.opera.com/dragonfly/)
From 810da31671a47a99841dea6061defd27332219a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 17:40:14 -0400
Subject: [PATCH 040/331] Finding & Evaluating Plugins: Link to plugin registry
Closes gh-460
---
page/plugins/finding-evaluating-plugins.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/plugins/finding-evaluating-plugins.md b/page/plugins/finding-evaluating-plugins.md
index 56544817..ea1c221a 100644
--- a/page/plugins/finding-evaluating-plugins.md
+++ b/page/plugins/finding-evaluating-plugins.md
@@ -10,7 +10,7 @@ One of the most celebrated aspects of jQuery is its extensive plugin ecosystem.
The quality of jQuery plugins varies widely. Many plugins are extensively tested and well-maintained, but others are hastily created and then ignored. More than a few fail to follow best practices. Some plugins, mainly [jQuery UI](http://jqueryui.com/), are maintained by the jQuery team. The quality of these plugins is as good as jQuery itself.
-Google is your best initial resource for locating plugins, though the jQuery team is working on an improved plugin repository. Once you've identified some options via a Google search, you may want to consult the jQuery mailing list or the `#jquery` IRC channel to get input from others.
+The easiest way to find plugins is to search Google or the [jQuery Plugins Registry](http://plugins.jquery.com/). Once you've identified some options, you may want to consult the [jQuery forums](http://forum.jquery.com/) or the `#jquery` IRC channel to get input from others.
When looking for a plugin to fill a need, do your homework. Ensure that the plugin is well-documented, and look for the author to provide lots of examples of its use. Be wary of plugins that do far more than you need; they can end up adding substantial overhead to your page. For more tips on spotting a sub-par plugin, read [Signs of a poorly written jQuery plugin](http://remysharp.com/2010/06/03/signs-of-a-poorly-written-jquery-plugin/) by Remy Sharp.
From f0102d58408745a01fb554988becc922ef2fd3f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 17:41:27 -0400
Subject: [PATCH 041/331] 0.3.10
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index db3853e0..e3f0cda5 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "learn.jquery.com",
"title": "jQuery Learning Site",
"description": "jQuery Foundation site for learning jQuery and JavaScript",
- "version": "0.3.9",
+ "version": "0.3.10",
"homepage": "http://learn.jquery.com",
"author": {
"name": "jQuery Foundation (http://jquery.org/)"
From 10ed6d1b7e7a83c6b37941b95ba49c8024c9b27a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 20:20:54 -0400
Subject: [PATCH 042/331] Conditional Code: Clarify what is truthy and falsy
Fixes gh-450
---
page/javascript-101/conditional-code.md | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/page/javascript-101/conditional-code.md b/page/javascript-101/conditional-code.md
index 5b606ef3..dcf60d94 100644
--- a/page/javascript-101/conditional-code.md
+++ b/page/javascript-101/conditional-code.md
@@ -43,21 +43,22 @@ Be mindful not to define functions with the same name multiple times within sepa
In order to use flow control successfully, it's important to understand which kinds of values are "truthy" and which kinds of values are "falsy." Sometimes, values that seem like they should evaluate one way actually evaluate another.
```
-// Values that evaluate to true:
-"0";
-"any string";
-[]; // An empty array.
-{}; // An empty object.
-1; // Any non-zero number.
+// Values that evaluate to false:
+false
+"" // An empty string.
+NaN // JavaScript's "not-a-number" variable.
+null
+undefined // Be careful -- undefined can be redefined!
+0 // The number zero.
```
```
-// Values that evaluate to false:
-""; // An empty string.
-NaN; // JavaScript's "not-a-number" variable.
-null;
-undefined; // Be careful -- undefined can be redefined!
-0; // The number zero.
+// Everything else evaluates to true, some examples:
+"0"
+"any string"
+[] // An empty array.
+{} // An empty object.
+1 // Any non-zero number.
```
## Conditional Variable Assignment with the Ternary Operator
From b137fd289aea16ac4c51fa19ff1b116f32fba661 Mon Sep 17 00:00:00 2001
From: Leo Baker-Hytch
Date: Mon, 24 Feb 2014 00:46:34 +0000
Subject: [PATCH 043/331] Scope: Fix explanation of variable scope
Closes gh-473
---
page/javascript-101/scope.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/javascript-101/scope.md b/page/javascript-101/scope.md
index 3a817482..a7963964 100644
--- a/page/javascript-101/scope.md
+++ b/page/javascript-101/scope.md
@@ -121,7 +121,7 @@ sayHello(); // "hello"
console.log( foo ); // "world"
```
-When you reference a global variable within a function, that function can see changes to the variable value after the function is defined.
+When, within a function, you reference a variable defined in an outer scope, that function can see changes to the variable's value after the function is defined.
```
var myFunction = function() {
From 24e5a0fdc711a83cc7328687f4b1be04334edea4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 20:25:27 -0400
Subject: [PATCH 044/331] Closures: Fix typo
Closes gh-458
---
page/javascript-101/closures.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/page/javascript-101/closures.md b/page/javascript-101/closures.md
index 8945fc20..b1607563 100644
--- a/page/javascript-101/closures.md
+++ b/page/javascript-101/closures.md
@@ -44,7 +44,8 @@ Closures can also be used to resolve issues with the `this` keyword, which is un
var outerObj = {
myName: "outer",
outerFunction: function() {
- // provide a reference to outerObj through innerFunction"s closure
+
+ // Provide a reference to outerObj through innerFunction's closure
var self = this;
var innerObj = {
myName: "inner",
From 90a8bc80afa802fb76da12874eb3523ec5cf4b7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?=
Date: Thu, 3 Apr 2014 20:27:29 -0400
Subject: [PATCH 045/331] Selecting Elements: Fix typo
Closes gh-451
---
page/using-jquery-core/selecting-elements.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/page/using-jquery-core/selecting-elements.md b/page/using-jquery-core/selecting-elements.md
index 68059a93..e05fa7a6 100644
--- a/page/using-jquery-core/selecting-elements.md
+++ b/page/using-jquery-core/selecting-elements.md
@@ -255,7 +255,7 @@ In order to get the best performance using `:selected`, first select elements wi
#### :submit
-Using the `:submit` pseudo-selector targets any `