Skip to content

Commit 36e7fd6

Browse files
committed
Widget: Multiple option arguments can be passed. Fixes #172
1 parent b733b36 commit 36e7fd6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

entries/jQuery.widget.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141

4242
<p>We can pass as many or as few options as we want during initialization. Any options that we don't pass will just use their default values.</p>
4343

44+
<p>You can pass multiple options arguments. Those arguments will be merged into one object (similar to <a href="http://api.jquery.com/jQuery.extend/"><code>$.extend( true, target, object1, objectN )</code></a>). This is useful for sharing options between instances, while overriding some settings for each one:</p>
45+
46+
<pre><code>
47+
var options = { modal: true, show: "slow" };
48+
$( "#dialog1" ).dialog( options );
49+
$( "#dialog2" ).dialog( options, { autoOpen: false });
50+
</code></pre>
51+
4452
<p>All options passed on init are deep-copied to ensure the objects can be modified later without affecting the widget. Arrays are the only exception, they are referenced as-is. This exception is in place to support data-binding, where the data source has to be kept as a reference.</p>
4553

4654
<p>The default values are stored on the widget's prototype, therefore we have the ability to override the values that jQuery UI sets. For example, after setting the following, all future progressbar instances will default to a value of 80:</p>

0 commit comments

Comments
 (0)