38 | | // ### Get a selector's first subview |
39 | | // |
40 | | // Fetches the first subview that matches a given `selector`. |
41 | | // |
42 | | // If no `selector` is provided, it will grab the first subview |
43 | | // attached to the view's root. |
44 | | // |
45 | | // Useful when a selector only has one subview at a time. |
| 47 | /** |
| 48 | * Fetches the first subview that matches a given `selector`. |
| 49 | * |
| 50 | * If no `selector` is provided, it will grab the first subview |
| 51 | * attached to the view's root. |
| 52 | * |
| 53 | * Useful when a selector only has one subview at a time. |
| 54 | * |
| 55 | * @param {string} selector A jQuery selector. |
| 56 | * |
| 57 | * @return {Backbone.View} The view. |
| 58 | */ |
50 | | |
51 | | // ### Register subview(s) |
52 | | // |
53 | | // Registers any number of `views` to a `selector`. |
54 | | // |
55 | | // When no `selector` is provided, the root selector (the empty string) |
56 | | // is used. `views` accepts a `Backbone.View` instance or an array of |
57 | | // `Backbone.View` instances. |
58 | | // |
59 | | // --- |
60 | | // |
61 | | // Accepts an `options` object, which has a significant effect on the |
62 | | // resulting behavior. |
63 | | // |
64 | | // `options.silent` – *boolean, `false`* |
65 | | // > If `options.silent` is true, no DOM modifications will be made. |
66 | | // |
67 | | // `options.add` – *boolean, `false`* |
68 | | // > Use `Views.add()` as a shortcut for setting `options.add` to true. |
69 | | // |
70 | | // > By default, the provided `views` will replace |
71 | | // any existing views associated with the selector. If `options.add` |
72 | | // is true, the provided `views` will be added to the existing views. |
73 | | // |
74 | | // `options.at` – *integer, `undefined`* |
75 | | // > When adding, to insert `views` at a specific index, use |
76 | | // `options.at`. By default, `views` are added to the end of the array. |
| 63 | /** |
| 64 | * Register subview(s) |
| 65 | * |
| 66 | * Registers any number of `views` to a `selector`. |
| 67 | * |
| 68 | * When no `selector` is provided, the root selector (the empty string) |
| 69 | * is used. `views` accepts a `Backbone.View` instance or an array of |
| 70 | * `Backbone.View` instances. |
| 71 | * |
| 72 | * --- |
| 73 | * |
| 74 | * Accepts an `options` object, which has a significant effect on the |
| 75 | * resulting behavior. |
| 76 | * |
| 77 | * `options.silent` – *boolean, `false`* |
| 78 | * > If `options.silent` is true, no DOM modifications will be made. |
| 79 | * |
| 80 | * `options.add` – *boolean, `false`* |
| 81 | * > Use `Views.add()` as a shortcut for setting `options.add` to true. |
| 82 | * |
| 83 | * > By default, the provided `views` will replace |
| 84 | * any existing views associated with the selector. If `options.add` |
| 85 | * is true, the provided `views` will be added to the existing views. |
| 86 | * |
| 87 | * `options.at` – *integer, `undefined`* |
| 88 | * > When adding, to insert `views` at a specific index, use |
| 89 | * `options.at`. By default, `views` are added to the end of the array. |
| 90 | * |
| 91 | * @param {string} selector A jQuery selector. |
| 92 | * @param {array|object} views The subviews for the main view. |
| 93 | * @param {} options |
| 94 | * |
| 95 | * @return |
| 96 | */ |
131 | | |
132 | | // ### Add subview(s) to existing subviews |
133 | | // |
134 | | // An alias to `Views.set()`, which defaults `options.add` to true. |
135 | | // |
136 | | // Adds any number of `views` to a `selector`. |
137 | | // |
138 | | // When no `selector` is provided, the root selector (the empty string) |
139 | | // is used. `views` accepts a `Backbone.View` instance or an array of |
140 | | // `Backbone.View` instances. |
141 | | // |
142 | | // Use `Views.set()` when setting `options.add` to `false`. |
143 | | // |
144 | | // Accepts an `options` object. By default, provided `views` will be |
145 | | // inserted at the end of the array of existing views. To insert |
146 | | // `views` at a specific index, use `options.at`. If `options.silent` |
147 | | // is true, no DOM modifications will be made. |
148 | | // |
149 | | // For more information on the `options` object, see `Views.set()`. |
| 151 | /** |
| 152 | * Add subview(s) to existing subviews |
| 153 | * |
| 154 | * An alias to `Views.set()`, which defaults `options.add` to true. |
| 155 | * |
| 156 | * Adds any number of `views` to a `selector`. |
| 157 | * |
| 158 | * When no `selector` is provided, the root selector (the empty string) |
| 159 | * is used. `views` accepts a `Backbone.View` instance or an array of |
| 160 | * `Backbone.View` instances. |
| 161 | * |
| 162 | * Use `Views.set()` when setting `options.add` to `false`. |
| 163 | * |
| 164 | * Accepts an `options` object. By default, provided `views` will be |
| 165 | * inserted at the end of the array of existing views. To insert |
| 166 | * `views` at a specific index, use `options.at`. If `options.silent` |
| 167 | * is true, no DOM modifications will be made. |
| 168 | * |
| 169 | * For more information on the `options` object, see `Views.set()`. |
| 170 | * |
| 171 | * @param {string} selector A jQuery selector. |
| 172 | * @param {array|object} views The subviews for the main view. |
| 173 | * @param {} options |
| 174 | * |
| 175 | * @return |
| 176 | */ |
159 | | |
160 | | // ### Stop tracking subviews |
161 | | // |
162 | | // Stops tracking `views` registered to a `selector`. If no `views` are |
163 | | // set, then all of the `selector`'s subviews will be unregistered and |
164 | | // removed. |
165 | | // |
166 | | // Accepts an `options` object. If `options.silent` is set, `remove` |
167 | | // will *not* be triggered on the unregistered views. |
| 186 | /** |
| 187 | * Stop tracking subviews |
| 188 | * |
| 189 | * Stops tracking `views` registered to a `selector`. If no `views` are |
| 190 | * set, then all of the `selector`'s subviews will be unregistered and |
| 191 | * removed. |
| 192 | * |
| 193 | * Accepts an `options` object. If `options.silent` is set, `remove` |
| 194 | * will *not* be triggered on the unregistered views. |
| 195 | * |
| 196 | * @param {string} selector A jQuery selector. |
| 197 | * @param {array|object} views The subviews for the main view. |
| 198 | * @param {} options |
| 199 | * |
| 200 | * @return |
| 201 | */ |
216 | | |
217 | | // ### Remove all subviews |
218 | | // |
219 | | // Triggers the `remove()` method on all subviews. Detaches the master |
220 | | // view from its parent. Resets the internals of the views manager. |
221 | | // |
222 | | // Accepts an `options` object. If `options.silent` is set, `unset` |
223 | | // will *not* be triggered on the master view's parent. |
| 256 | /** |
| 257 | * Remove all subviews |
| 258 | * |
| 259 | * Triggers the `remove()` method on all subviews. Detaches the master |
| 260 | * view from its parent. Resets the internals of the views manager. |
| 261 | * |
| 262 | * Accepts an `options` object. If `options.silent` is set, `unset` |
| 263 | * will *not* be triggered on the master view's parent. |
| 264 | * |
| 265 | * @param {} options |
| 266 | * |
| 267 | * @return {} |
| 268 | */ |
246 | | |
247 | | // ### Insert subviews into a selector |
248 | | // |
249 | | // By default, appends the subview `els` to the end of the `$target` |
250 | | // selector. If `options.at` is set, inserts the subview `els` at the |
251 | | // provided index. |
252 | | // |
253 | | // Can be overridden in subclasses. |
| 297 | /** |
| 298 | * Insert subviews into a selector |
| 299 | * |
| 300 | * By default, appends the subview `els` to the end of the `$target` |
| 301 | * selector. If `options.at` is set, inserts the subview `els` at the |
| 302 | * provided index. |
| 303 | * |
| 304 | * Can be overridden in subclasses. |
| 305 | * |
| 306 | * @param {} target |
| 307 | * @param {} els |
| 308 | * @param {} options |
| 309 | * |
| 310 | * @return |
| 311 | */ |
281 | | |
282 | | // #### Internal. Attaches a series of views to a selector. |
283 | | // |
284 | | // Checks to see if a matching selector exists, renders the views, |
285 | | // performs the proper DOM operation, and then checks if the view is |
286 | | // attached to the document. |
| 339 | /** |
| 340 | * Internal. Attaches a series of views to a selector. |
| 341 | * |
| 342 | * Checks to see if a matching selector exists, renders the views, |
| 343 | * performs the proper DOM operation, and then checks if the view is |
| 344 | * attached to the document. |
| 345 | * |
| 346 | * @param {string} selector A jQuery selector. |
| 347 | * @param {array|object} views The subviews for the main view. |
| 348 | * @param {} options |
| 349 | * |
| 350 | * @return |
| 351 | */ |