~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/docs/node/nodelist.html

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang="en">
3
 
<head>
4
 
    <meta charset="utf-8">
5
 
    <title>Example: NodeList</title>
6
 
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.4.0pr3/build/cssgrids/grids-min.css">
7
 
    <link rel="stylesheet" href="../assets/css/main.css">
8
 
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
9
 
    <script src="../../build/yui/yui-min.js"></script>
10
 
</head>
11
 
<body>
12
 
 
13
 
<div id="doc">
14
 
    <h1>Example: NodeList</h1>
15
 
 
16
 
    
17
 
 
18
 
    <div class="yui3-g">
19
 
        <div id="main" class="yui3-u">
20
 
            <div class="content"><link href="../assets/node/node.css" rel="stylesheet" type="text/css">
21
 
<div class="intro">
22
 
    <p>This example demonstrates how to use a NodeList instance to work with multiple nodes.</p>
23
 
</div>
24
 
 
25
 
<div class="example">
26
 
<ul id="demo">
27
 
    <li>Click me</li>
28
 
    <li>Click me</li>
29
 
    <li>Click me</li>
30
 
    <li>Click me</li>
31
 
</ul>
32
 
 
33
 
<script type="text/javascript">
34
 
YUI().use('node', function(Y) {
35
 
    var nodes = Y.all('#demo li');
36
 
 
37
 
    var onClick = function(e) {
38
 
        // this === nodes
39
 
        this.setContent('thanks from all of us!');
40
 
 
41
 
        // e.currentTarget === #demo li
42
 
        e.currentTarget.addClass('highlight');
43
 
    };
44
 
 
45
 
    nodes.on('click', onClick);
46
 
});
47
 
</script>
48
 
 
49
 
</div>
50
 
 
51
 
<h2>Setting up the Node</h2>
52
 
<p>First we need some HTML to work with.</p>
53
 
<pre class="code prettyprint">&lt;ul id=&quot;demo&quot;&gt;
54
 
    &lt;li&gt;lorem&lt;&#x2F;li&gt;
55
 
    &lt;li&gt;ispum&lt;&#x2F;li&gt;
56
 
    &lt;li&gt;dolor&lt;&#x2F;li&gt;
57
 
    &lt;li&gt;sit&lt;&#x2F;li&gt;
58
 
&lt;&#x2F;ul&gt;</pre>
59
 
 
60
 
 
61
 
<h2>Geting a NodeList Instance</h2>
62
 
<p>We will use the <code>all</code> method of our YUI instance to get a NodeList instance to work with.</p>
63
 
<pre class="code prettyprint">var nodes = Y.all(&#x27;#demo li&#x27;);</pre>
64
 
 
65
 
 
66
 
<h2>Accessing NodeList Properties</h2>
67
 
<p>As with Node, simple type of properties (strings, numbers, booleans) pass directly to/from the underlying HTMLElement, however properties representing HTMLElements return Node instances.</p>
68
 
<p>In this example, we will listen for a <code>click</code> event to trigger the property change.</p>
69
 
<p>Note that the context of the handler is set to the NodeList, so <code>this</code> refers to our NodeList instance.  The <code>currentTarget</code> property of the event object is set to the current Node instance.</p>
70
 
<pre class="code prettyprint">var onClick = function(e) {
71
 
    &#x2F;&#x2F; this === nodes
72
 
    this.setContent(&#x27;thanks from all of us!&#x27;);
73
 
 
74
 
    &#x2F;&#x2F; e.currentTarget === #demo li
75
 
    e.currentTarget.setStyle(&#x27;backgroundColor&#x27;, &#x27;green&#x27;);
76
 
};</pre>
77
 
 
78
 
 
79
 
<h2>Prefer <code>node.delegate()</code> over <code>nodelist.on()</code></h2>
80
 
 
81
 
<p>Sometimes you need to create individual subscriptions for each Node in a NodeList (as is done in this example), but usually it's preferable to <a href="node-evt-delegation.html">use event delegation</a>.</p>
82
 
 
83
 
<h2>Complete Example Source</h2>
84
 
<pre class="code prettyprint">&lt;ul id=&quot;demo&quot;&gt;
85
 
    &lt;li&gt;Click me&lt;&#x2F;li&gt;
86
 
    &lt;li&gt;Click me&lt;&#x2F;li&gt;
87
 
    &lt;li&gt;Click me&lt;&#x2F;li&gt;
88
 
    &lt;li&gt;Click me&lt;&#x2F;li&gt;
89
 
&lt;&#x2F;ul&gt;
90
 
 
91
 
&lt;script type=&quot;text&#x2F;javascript&quot;&gt;
92
 
YUI().use(&#x27;node&#x27;, function(Y) {
93
 
    var nodes = Y.all(&#x27;#demo li&#x27;);
94
 
 
95
 
    var onClick = function(e) {
96
 
        &#x2F;&#x2F; this === nodes
97
 
        this.setContent(&#x27;thanks from all of us!&#x27;);
98
 
 
99
 
        &#x2F;&#x2F; e.currentTarget === #demo li
100
 
        e.currentTarget.addClass(&#x27;highlight&#x27;);
101
 
    };
102
 
 
103
 
    nodes.on(&#x27;click&#x27;, onClick);
104
 
});
105
 
&lt;&#x2F;script&gt;</pre>
106
 
 
107
 
</div>
108
 
        </div>
109
 
 
110
 
        <div id="sidebar" class="yui3-u">
111
 
            
112
 
 
113
 
            
114
 
                <div class="sidebox">
115
 
                    <div class="hd">
116
 
                        <h2 class="no-toc">Examples</h2>
117
 
                    </div>
118
 
 
119
 
                    <div class="bd">
120
 
                        <ul class="examples">
121
 
                            
122
 
                                
123
 
                                    <li data-description="Using selectors and property accessors with Node.">
124
 
                                        <a href="properties.html">Set and Get Properties</a>
125
 
                                    </li>
126
 
                                
127
 
                            
128
 
                                
129
 
                                    <li data-description="Using DOM methods with Node.">
130
 
                                        <a href="dom-node.html">DOM Methods</a>
131
 
                                    </li>
132
 
                                
133
 
                            
134
 
                                
135
 
                                    <li data-description="Listening for DOM events with Node instances.">
136
 
                                        <a href="events.html">Handling DOM Events</a>
137
 
                                    </li>
138
 
                                
139
 
                            
140
 
                                
141
 
                                    <li data-description="NodeList provides Node functionality for multiple nodes.">
142
 
                                        <a href="nodelist.html">NodeList</a>
143
 
                                    </li>
144
 
                                
145
 
                            
146
 
                                
147
 
                                    <li data-description="Using a single event listener to handle events on multiple nodes.">
148
 
                                        <a href="node-evt-delegation.html">Delegating Node Events</a>
149
 
                                    </li>
150
 
                                
151
 
                            
152
 
                                
153
 
                                    <li data-description="This example demonstrates how to position an element in page coordinates.">
154
 
                                        <a href="node-xy.html">Node Positioning</a>
155
 
                                    </li>
156
 
                                
157
 
                            
158
 
                                
159
 
                                    <li data-description="This example demonstrates how to set styles and get style information.">
160
 
                                        <a href="node-style.html">Node Styling</a>
161
 
                                    </li>
162
 
                                
163
 
                            
164
 
                                
165
 
                                    <li data-description="This example demonstrates how to insert content into a Node.">
166
 
                                        <a href="node-insert.html">Adding Node Content</a>
167
 
                                    </li>
168
 
                                
169
 
                            
170
 
                                
171
 
                                    <li data-description="This example demonstrates how to show and hide a Node.">
172
 
                                        <a href="node-view.html">Showing and Hiding</a>
173
 
                                    </li>
174
 
                                
175
 
                            
176
 
                                
177
 
                            
178
 
                                
179
 
                            
180
 
                                
181
 
                            
182
 
                                
183
 
                            
184
 
                                
185
 
                            
186
 
                                
187
 
                            
188
 
                                
189
 
                            
190
 
                        </ul>
191
 
                    </div>
192
 
                </div>
193
 
            
194
 
 
195
 
            
196
 
                <div class="sidebox">
197
 
                    <div class="hd">
198
 
                        <h2 class="no-toc">Examples That Use This Component</h2>
199
 
                    </div>
200
 
 
201
 
                    <div class="bd">
202
 
                        <ul class="examples">
203
 
                            
204
 
                                
205
 
                            
206
 
                                
207
 
                            
208
 
                                
209
 
                            
210
 
                                
211
 
                            
212
 
                                
213
 
                            
214
 
                                
215
 
                            
216
 
                                
217
 
                            
218
 
                                
219
 
                            
220
 
                                
221
 
                            
222
 
                                
223
 
                                    <li data-description="Use the Event Utility to attach simple DOM event handlers.">
224
 
                                        <a href="../event/basic-example.html">Simple DOM Events</a>
225
 
                                    </li>
226
 
                                
227
 
                            
228
 
                                
229
 
                                    <li data-description="Creating an accessible toolbar using the Focus Manager Node Plugin and Node&#x27;s support for the WAI-ARIA Roles and States.">
230
 
                                        <a href="../node-focusmanager/node-focusmanager-1.html">Accessible Toolbar</a>
231
 
                                    </li>
232
 
                                
233
 
                            
234
 
                                
235
 
                                    <li data-description="Creating an accessible menu button using the Focus Manager Node Plugin, Event&#x27;s delegation support and mouseenter event, along with the Overlay widget and Node&#x27;s support for the WAI-ARIA Roles and States.">
236
 
                                        <a href="../node-focusmanager/node-focusmanager-3.html">Accessible Menu Button</a>
237
 
                                    </li>
238
 
                                
239
 
                            
240
 
                                
241
 
                                    <li data-description="Use IO to request XML data from a remote web service.">
242
 
                                        <a href="../io/weather.html">Request XML data from Yahoo! Weather</a>
243
 
                                    </li>
244
 
                                
245
 
                            
246
 
                                
247
 
                                    <li data-description="Use IO to make a cross-domain request to Yahoo! Pipes, returning data from disparate sources.">
248
 
                                        <a href="../io/xdr.html">Request JSON using Yahoo! Pipes</a>
249
 
                                    </li>
250
 
                                
251
 
                            
252
 
                                
253
 
                                    <li data-description="Example Photo Browser application.">
254
 
                                        <a href="../dd/photo-browser.html">Photo Browser</a>
255
 
                                    </li>
256
 
                                
257
 
                            
258
 
                                
259
 
                                    <li data-description="Portal style example using Drag &amp; Drop Event Bubbling and Animation.">
260
 
                                        <a href="../dd/portal-drag.html">Portal Style Example</a>
261
 
                                    </li>
262
 
                                
263
 
                            
264
 
                        </ul>
265
 
                    </div>
266
 
                </div>
267
 
            
268
 
        </div>
269
 
    </div>
270
 
</div>
271
 
 
272
 
<script src="../assets/vendor/prettify/prettify-min.js"></script>
273
 
<script>prettyPrint();</script>
274
 
 
275
 
</body>
276
 
</html>