Skip to content
This repository

Fix #2532824. Scrub for Y.each and @description. #298

Merged
merged 1 commit into from over 1 year ago

2 participants

Anthony Pipkin YUI Build
Anthony Pipkin
Collaborator

Fix #2532824. Scrub for Y.each and @description. Minor performance updates with Y.Object.keys and Y.Array.hash.

@davglass

YUI Build yuibuild merged commit 383b3fd into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 08, 2012
Anthony Pipkin apipkin Fix #2532824. Scrub for Y.each and @description. Minor performance up…
…dates with Y.Object.keys and Y.Array.hash.
383b3fd
This page is out of date. Refresh to see the latest.
82 src/dd/js/constrain.js
@@ -33,16 +33,16 @@
33 33 proto = null,
34 34
35 35 /**
  36 + * Fires when this node is aligned with the tickX value.
36 37 * @event drag:tickAlignX
37   - * @description Fires when this node is aligned with the tickX value.
38 38 * @param {EventFacade} event An Event Facade object
39 39 * @type {CustomEvent}
40 40 */
41 41 EV_TICK_ALIGN_X = 'drag:tickAlignX',
42 42
43 43 /**
  44 + * Fires when this node is aligned with the tickY value.
44 45 * @event drag:tickAlignY
45   - * @description Fires when this node is aligned with the tickY value.
46 46 * @param {EventFacade} event An Event Facade object
47 47 * @type {CustomEvent}
48 48 */
@@ -55,63 +55,63 @@
55 55
56 56 C.NAME = 'ddConstrained';
57 57 /**
  58 + * The Constrained instance will be placed on the Drag instance under the con namespace.
58 59 * @property NS
59 60 * @default con
60 61 * @readonly
61 62 * @protected
62 63 * @static
63   - * @description The Constrained instance will be placed on the Drag instance under the con namespace.
64 64 * @type {String}
65   -*/
  65 + */
66 66 C.NS = 'con';
67 67
68 68 C.ATTRS = {
69 69 host: {
70 70 },
71 71 /**
  72 + * Stick the drag movement to the X-Axis. Default: false
72 73 * @attribute stickX
73   - * @description Stick the drag movement to the X-Axis. Default: false
74 74 * @type Boolean
75 75 */
76 76 stickX: {
77 77 value: false
78 78 },
79 79 /**
80   - * @attribute stickY
81   - * @description Stick the drag movement to the Y-Axis
  80 + * Stick the drag movement to the Y-Axis
82 81 * @type Boolean
  82 + * @attribute stickY
83 83 */
84 84 stickY: {
85 85 value: false
86 86 },
87 87 /**
88   - * @attribute tickX
89   - * @description The X tick offset the drag node should snap to on each drag move. False for no ticks. Default: false
  88 + * The X tick offset the drag node should snap to on each drag move. False for no ticks. Default: false
90 89 * @type Number/false
  90 + * @attribute tickX
91 91 */
92 92 tickX: {
93 93 value: false
94 94 },
95 95 /**
96   - * @attribute tickY
97   - * @description The Y tick offset the drag node should snap to on each drag move. False for no ticks. Default: false
  96 + * The Y tick offset the drag node should snap to on each drag move. False for no ticks. Default: false
98 97 * @type Number/false
  98 + * @attribute tickY
99 99 */
100 100 tickY: {
101 101 value: false
102 102 },
103 103 /**
104   - * @attribute tickXArray
105   - * @description An array of page coordinates to use as X ticks for drag movement.
  104 + * An array of page coordinates to use as X ticks for drag movement.
106 105 * @type Array
  106 + * @attribute tickXArray
107 107 */
108 108 tickXArray: {
109 109 value: false
110 110 },
111 111 /**
112   - * @attribute tickYArray
113   - * @description An array of page coordinates to use as Y ticks for drag movement.
  112 + * An array of page coordinates to use as Y ticks for drag movement.
114 113 * @type Array
  114 + * @attribute tickYArray
115 115 */
116 116 tickYArray: {
117 117 value: false
@@ -129,11 +129,11 @@
129 129 }
130 130 },
131 131 /**
132   - * @attribute constrain
133   - * @description Will attempt to constrain the drag node to the boundaries. Arguments:<br>
  132 + * Will attempt to constrain the drag node to the boundaries. Arguments:<br>
134 133 * 'view': Contrain to Viewport<br>
135 134 * '#selector_string': Constrain to this node<br>
136 135 * '{Region Object}': An Object Literal containing a valid region (top, right, bottom, left) of page positions
  136 + * @attribute constrain
137 137 * @type {String/Object/Node}
138 138 */
139 139 constrain: {
@@ -147,9 +147,9 @@
147 147 }
148 148 },
149 149 /**
  150 + * An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to.
150 151 * @deprecated
151 152 * @attribute constrain2region
152   - * @description An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to.
153 153 * @type Object
154 154 */
155 155 constrain2region: {
@@ -158,9 +158,9 @@
158 158 }
159 159 },
160 160 /**
  161 + * Will attempt to constrain the drag node to the boundaries of this node.
161 162 * @deprecated
162 163 * @attribute constrain2node
163   - * @description Will attempt to constrain the drag node to the boundaries of this node.
164 164 * @type Object
165 165 */
166 166 constrain2node: {
@@ -169,9 +169,9 @@
169 169 }
170 170 },
171 171 /**
  172 + * Will attempt to constrain the drag node to the boundaries of the viewport region.
172 173 * @deprecated
173 174 * @attribute constrain2view
174   - * @description Will attempt to constrain the drag node to the boundaries of the viewport region.
175 175 * @type Object
176 176 */
177 177 constrain2view: {
@@ -180,8 +180,8 @@
180 180 }
181 181 },
182 182 /**
  183 + * Should the region be cached for performace. Default: true
183 184 * @attribute cacheRegion
184   - * @description Should the region be cached for performace. Default: true
185 185 * @type Boolean
186 186 */
187 187 cacheRegion: {
@@ -204,7 +204,7 @@
204 204 ];
205 205 },
206 206 destructor: function() {
207   - Y.each(
  207 + Y.Array.each(
208 208 this._eventHandles,
209 209 function(handle) {
210 210 handle.detach();
@@ -214,9 +214,9 @@
214 214 this._eventHandles.length = 0;
215 215 },
216 216 /**
  217 + * This method creates all the events for this Event Target and publishes them so we get Event Bubbling.
217 218 * @private
218 219 * @method _createEvents
219   - * @description This method creates all the events for this Event Target and publishes them so we get Event Bubbling.
220 220 */
221 221 _createEvents: function() {
222 222 var ev = [
@@ -224,7 +224,7 @@
224 224 EV_TICK_ALIGN_Y
225 225 ];
226 226
227   - Y.each(ev, function(v) {
  227 + Y.Array.each(ev, function(v) {
228 228 this.publish(v, {
229 229 type: v,
230 230 emitFacade: true,
@@ -235,48 +235,48 @@
235 235 }, this);
236 236 },
237 237 /**
  238 + * Fires on drag:end
238 239 * @private
239 240 * @method _handleEnd
240   - * @description Fires on drag:end
241 241 */
242 242 _handleEnd: function() {
243 243 this._lastTickYFired = null;
244 244 this._lastTickXFired = null;
245 245 },
246 246 /**
  247 + * Fires on drag:start and clears the _regionCache
247 248 * @private
248 249 * @method _handleStart
249   - * @description Fires on drag:start and clears the _regionCache
250 250 */
251 251 _handleStart: function() {
252 252 this.resetCache();
253 253 },
254 254 /**
  255 + * Store a cache of the region that we are constraining to
255 256 * @private
256 257 * @property _regionCache
257   - * @description Store a cache of the region that we are constraining to
258 258 * @type Object
259 259 */
260 260 _regionCache: null,
261 261 /**
  262 + * Get's the region and caches it, called from window.resize and when the cache is null
262 263 * @private
263 264 * @method _cacheRegion
264   - * @description Get's the region and caches it, called from window.resize and when the cache is null
265 265 */
266 266 _cacheRegion: function() {
267 267 this._regionCache = this.get('constrain').get('region');
268 268 },
269 269 /**
  270 + * Reset the internal region cache.
270 271 * @method resetCache
271   - * @description Reset the internal region cache.
272 272 */
273 273 resetCache: function() {
274 274 this._regionCache = null;
275 275 },
276 276 /**
  277 + * Standardizes the 'constraint' attribute
277 278 * @private
278 279 * @method _getConstraint
279   - * @description Standardizes the 'constraint' attribute
280 280 */
281 281 _getConstraint: function() {
282 282 var con = this.get('constrain'),
@@ -304,7 +304,7 @@
304 304 region = this.get(HOST).get(DRAG_NODE).get('viewportRegion');
305 305 }
306 306
307   - Y.each(g, function(i, n) {
  307 + Y.Object.each(g, function(i, n) {
308 308 if ((n === RIGHT) || (n === BOTTOM)) {
309 309 region[n] -= i;
310 310 } else {
@@ -315,8 +315,8 @@
315 315 },
316 316
317 317 /**
  318 + * Get the active region: viewport, node, custom region
318 319 * @method getRegion
319   - * @description Get the active region: viewport, node, custom region
320 320 * @param {Boolean} inc Include the node's height and width
321 321 * @return {Object} The active region.
322 322 */
@@ -335,9 +335,9 @@
335 335 return r;
336 336 },
337 337 /**
  338 + * Check if xy is inside a given region, if not change to it be inside.
338 339 * @private
339 340 * @method _checkRegion
340   - * @description Check if xy is inside a given region, if not change to it be inside.
341 341 * @param {Array} _xy The XY to check if it's in the current region, if it isn't
342 342 * inside the region, it will reset the xy array to be inside the region.
343 343 * @return {Array} The new XY that is inside the region
@@ -366,8 +366,8 @@
366 366 return _xy;
367 367 },
368 368 /**
  369 + * Checks if the XY passed or the dragNode is inside the active region.
369 370 * @method inRegion
370   - * @description Checks if the XY passed or the dragNode is inside the active region.
371 371 * @param {Array} xy Optional XY to check, if not supplied this.get('dragNode').getXY() is used.
372 372 * @return {Boolean} True if the XY is inside the region, false otherwise.
373 373 */
@@ -382,8 +382,8 @@
382 382 return inside;
383 383 },
384 384 /**
  385 + * Modifies the Drag.actXY method from the after drag:align event. This is where the constraining happens.
385 386 * @method align
386   - * @description Modifies the Drag.actXY method from the after drag:align event. This is where the constraining happens.
387 387 */
388 388 align: function() {
389 389 var host = this.get(HOST),
@@ -406,8 +406,8 @@
406 406 host.actXY = _xy;
407 407 },
408 408 /**
  409 + * Fires after drag:drag. Handle the tickX and tickX align events.
409 410 * @method drag
410   - * @description Fires after drag:drag. Handle the tickX and tickX align events.
411 411 */
412 412 drag: function() {
413 413 var host = this.get(HOST),
@@ -426,9 +426,9 @@
426 426 }
427 427 },
428 428 /**
  429 + * This method delegates the proper helper method for tick calculations
429 430 * @private
430 431 * @method _checkTicks
431   - * @description This method delegates the proper helper method for tick calculations
432 432 * @param {Array} xy The XY coords for the Drag
433 433 * @param {Object} r The optional region that we are bound to.
434 434 * @return {Array} The calced XY coords
@@ -455,17 +455,17 @@
455 455 return xy;
456 456 },
457 457 /**
  458 + * Fires when the actXY[0] reach a new value respecting the tickX gap.
458 459 * @private
459 460 * @method _tickAlignX
460   - * @description Fires when the actXY[0] reach a new value respecting the tickX gap.
461 461 */
462 462 _tickAlignX: function() {
463 463 this.fire(EV_TICK_ALIGN_X);
464 464 },
465 465 /**
  466 + * Fires when the actXY[1] reach a new value respecting the tickY gap.
466 467 * @private
467 468 * @method _tickAlignY
468   - * @description Fires when the actXY[1] reach a new value respecting the tickY gap.
469 469 */
470 470 _tickAlignY: function() {
471 471 this.fire(EV_TICK_ALIGN_Y);
@@ -478,11 +478,11 @@
478 478
479 479 Y.mix(DDM, {
480 480 /**
  481 + * Helper method to calculate the tick offsets for a given position
481 482 * @for DDM
482 483 * @namespace DD
483 484 * @private
484 485 * @method _calcTicks
485   - * @description Helper method to calculate the tick offsets for a given position
486 486 * @param {Number} pos The current X or Y position
487 487 * @param {Number} start The start X or Y position
488 488 * @param {Number} tick The X or Y tick increment
@@ -510,11 +510,11 @@
510 510 return pos;
511 511 },
512 512 /**
  513 + * This method is used with the tickXArray and tickYArray config options
513 514 * @for DDM
514 515 * @namespace DD
515 516 * @private
516 517 * @method _calcTickArray
517   - * @description This method is used with the tickXArray and tickYArray config options
518 518 * @param {Number} pos The current X or Y position
519 519 * @param {Number} ticks The array containing our custom tick positions.
520 520 * @param {Number} off1 The min offset that we can't pass (region)
4 src/dd/js/dd-drop-plugin.js
@@ -19,14 +19,14 @@
19 19 };
20 20
21 21 /**
  22 + * dd-drop-plugin
22 23 * @property NAME
23   - * @description dd-drop-plugin
24 24 * @type {String}
25 25 */
26 26 Drop.NAME = "dd-drop-plugin";
27 27 /**
  28 + * The Drop instance will be placed on the Node instance under the drop namespace. It can be accessed via Node.drop;
28 29 * @property NS
29   - * @description The Drop instance will be placed on the Node instance under the drop namespace. It can be accessed via Node.drop;
30 30 * @type {String}
31 31 */
32 32 Drop.NS = "drop";
4 src/dd/js/dd-plugin.js
@@ -28,15 +28,15 @@
28 28 EV_DRAG_END = 'drag:end';
29 29
30 30 /**
  31 + * dd-plugin
31 32 * @property NAME
32   - * @description dd-plugin
33 33 * @type {String}
34 34 */
35 35 Drag.NAME = "dd-plugin";
36 36
37 37 /**
  38 + * The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd;
38 39 * @property NS
39   - * @description The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd;
40 40 * @type {String}
41 41 */
42 42 Drag.NS = "dd";
56 src/dd/js/ddm-base.js
@@ -20,32 +20,32 @@
20 20
21 21 DDMBase.ATTRS = {
22 22 /**
  23 + * The cursor to apply when dragging, if shimmed the shim will get the cursor.
23 24 * @attribute dragCursor
24   - * @description The cursor to apply when dragging, if shimmed the shim will get the cursor.
25 25 * @type String
26 26 */
27 27 dragCursor: {
28 28 value: 'move'
29 29 },
30 30 /**
  31 + * The number of pixels to move to start a drag operation, default is 3.
31 32 * @attribute clickPixelThresh
32   - * @description The number of pixels to move to start a drag operation, default is 3.
33 33 * @type Number
34 34 */
35 35 clickPixelThresh: {
36 36 value: 3
37 37 },
38 38 /**
  39 + * The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.
39 40 * @attribute clickTimeThresh
40   - * @description The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.
41 41 * @type Number
42 42 */
43 43 clickTimeThresh: {
44 44 value: 1000
45 45 },
46 46 /**
  47 + * The number of milliseconds to throttle the mousemove event. Default: 150
47 48 * @attribute throttleTime
48   - * @description The number of milliseconds to throttle the mousemove event. Default: 150
49 49 * @type Number
50 50 */
51 51 throttleTime: {
@@ -70,15 +70,15 @@
70 70 Y.extend(DDMBase, Y.Base, {
71 71 _createPG: function() {},
72 72 /**
  73 + * flag set when we activate our first drag, so DDM can start listening for events.
73 74 * @property _active
74   - * @description flag set when we activate our first drag, so DDM can start listening for events.
75 75 * @type {Boolean}
76 76 */
77 77 _active: null,
78 78 /**
  79 + * Handler for dragMode attribute setter.
79 80 * @private
80 81 * @method _setDragMode
81   - * @description Handler for dragMode attribute setter.
82 82 * @param String/Number The Number value or the String for the DragMode to default all future drag instances to.
83 83 * @return Number The Mode to be set
84 84 */
@@ -100,29 +100,29 @@
100 100 return 0;
101 101 },
102 102 /**
  103 + * The PREFIX to attach to all DD CSS class names
103 104 * @property CSS_PREFIX
104   - * @description The PREFIX to attach to all DD CSS class names
105 105 * @type {String}
106 106 */
107 107 CSS_PREFIX: Y.ClassNameManager.getClassName('dd'),
108 108 _activateTargets: function() {},
109 109 /**
  110 + * Holder for all registered drag elements.
110 111 * @private
111 112 * @property _drags
112   - * @description Holder for all registered drag elements.
113 113 * @type {Array}
114 114 */
115 115 _drags: [],
116 116 /**
  117 + * A reference to the currently active draggable object.
117 118 * @property activeDrag
118   - * @description A reference to the currently active draggable object.
119 119 * @type {Drag}
120 120 */
121 121 activeDrag: false,
122 122 /**
  123 + * Adds a reference to the drag object to the DDM._drags array, called in the constructor of Drag.
123 124 * @private
124 125 * @method _regDrag
125   - * @description Adds a reference to the drag object to the DDM._drags array, called in the constructor of Drag.
126 126 * @param {Drag} d The Drag object
127 127 */
128 128 _regDrag: function(d) {
@@ -137,14 +137,14 @@
137 137 return true;
138 138 },
139 139 /**
  140 + * Remove this drag object from the DDM._drags array.
140 141 * @private
141 142 * @method _unregDrag
142   - * @description Remove this drag object from the DDM._drags array.
143 143 * @param {Drag} d The drag object.
144 144 */
145 145 _unregDrag: function(d) {
146 146 var tmp = [];
147   - Y.each(this._drags, function(n) {
  147 + Y.Array.each(this._drags, function(n) {
148 148 if (n !== d) {
149 149 tmp[tmp.length] = n;
150 150 }
@@ -152,9 +152,9 @@
152 152 this._drags = tmp;
153 153 },
154 154 /**
  155 + * Add the document listeners.
155 156 * @private
156 157 * @method _setupListeners
157   - * @description Add the document listeners.
158 158 */
159 159 _setupListeners: function() {
160 160 this._createPG();
@@ -165,18 +165,18 @@
165 165 doc.on('mouseup', Y.bind(this._end, this));
166 166 },
167 167 /**
  168 + * Internal method used by Drag to signal the start of a drag operation
168 169 * @private
169 170 * @method _start
170   - * @description Internal method used by Drag to signal the start of a drag operation
171 171 */
172 172 _start: function() {
173 173 this.fire('ddm:start');
174 174 this._startDrag();
175 175 },
176 176 /**
  177 + * Factory method to be overwritten by other DDM's
177 178 * @private
178 179 * @method _startDrag
179   - * @description Factory method to be overwritten by other DDM's
180 180 * @param {Number} x The x position of the drag element
181 181 * @param {Number} y The y position of the drag element
182 182 * @param {Number} w The width of the drag element
@@ -184,16 +184,16 @@
184 184 */
185 185 _startDrag: function() {},
186 186 /**
  187 + * Factory method to be overwritten by other DDM's
187 188 * @private
188 189 * @method _endDrag
189   - * @description Factory method to be overwritten by other DDM's
190 190 */
191 191 _endDrag: function() {},
192 192 _dropMove: function() {},
193 193 /**
  194 + * Internal method used by Drag to signal the end of a drag operation
194 195 * @private
195 196 * @method _end
196   - * @description Internal method used by Drag to signal the end of a drag operation
197 197 */
198 198 _end: function() {
199 199 if (this.activeDrag) {
@@ -205,8 +205,8 @@
205 205 }
206 206 },
207 207 /**
  208 + * Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag.
208 209 * @method stopDrag
209   - * @description Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag.
210 210 * @return {Self}
211 211 * @chainable
212 212 */
@@ -217,17 +217,17 @@
217 217 return this;
218 218 },
219 219 /**
  220 + * Set to true when drag starts and useShim is true. Used in pairing with _docMove
220 221 * @private
221 222 * @property _shimming
222   - * @description Set to true when drag starts and useShim is true. Used in pairing with _docMove
223 223 * @see _docMove
224 224 * @type {Boolean}
225 225 */
226 226 _shimming: false,
227 227 /**
  228 + * Internal listener for the mousemove on Document. Checks if the shim is in place to only call _move once per mouse move
228 229 * @private
229 230 * @method _docMove
230   - * @description Internal listener for the mousemove on Document. Checks if the shim is in place to only call _move once per mouse move
231 231 * @param {Event.Facade} ev The Dom mousemove Event
232 232 */
233 233 _docMove: function(ev) {
@@ -236,9 +236,9 @@
236 236 }
237 237 },
238 238 /**
  239 + * Internal listener for the mousemove DOM event to pass to the Drag's move method.
239 240 * @private
240 241 * @method _move
241   - * @description Internal listener for the mousemove DOM event to pass to the Drag's move method.
242 242 * @param {Event.Facade} ev The Dom mousemove Event
243 243 */
244 244 _move: function(ev) {
@@ -273,8 +273,8 @@
273 273 };
274 274 },
275 275 /**
  276 + * Get a valid Drag instance back from a Node or a selector string, false otherwise
276 277 * @method getDrag
277   - * @description Get a valid Drag instance back from a Node or a selector string, false otherwise
278 278 * @param {String/Object} node The Node instance or Selector string to check for a valid Drag Object
279 279 * @return {Object}
280 280 */
@@ -282,7 +282,7 @@
282 282 var drag = false,
283 283 n = Y.one(node);
284 284 if (n instanceof Y.Node) {
285   - Y.each(this._drags, function(v) {
  285 + Y.Array.each(this._drags, function(v) {
286 286 if (n.compareTo(v.get('node'))) {
287 287 drag = v;
288 288 }
@@ -291,8 +291,8 @@
291 291 return drag;
292 292 },
293 293 /**
  294 + * Swap the position of 2 nodes based on their CSS positioning.
294 295 * @method swapPosition
295   - * @description Swap the position of 2 nodes based on their CSS positioning.
296 296 * @param {Node} n1 The first node to swap
297 297 * @param {Node} n2 The first node to swap
298 298 * @return {Node}
@@ -308,8 +308,8 @@
308 308 return n1;
309 309 },
310 310 /**
  311 + * Return a node instance from the given node, selector string or Y.Base extended object.
311 312 * @method getNode
312   - * @description Return a node instance from the given node, selector string or Y.Base extended object.
313 313 * @param {Node/Object/String} n The node to resolve.
314 314 * @return {Node}
315 315 */
@@ -329,8 +329,8 @@
329 329 return n;
330 330 },
331 331 /**
  332 + * Swap the position of 2 nodes based on their DOM location.
332 333 * @method swapNode
333   - * @description Swap the position of 2 nodes based on their DOM location.
334 334 * @param {Node} n1 The first node to swap
335 335 * @param {Node} n2 The first node to swap
336 336 * @return {Node}
@@ -357,13 +357,13 @@
357 357 Y.DD.DDM = new DDMBase();
358 358
359 359 /**
  360 + * Fires from the DDM before all drag events fire.
360 361 * @event ddm:start
361   - * @description Fires from the DDM before all drag events fire.
362 362 * @type {CustomEvent}
363 363 */
364 364 /**
  365 + * Fires from the DDM after the DDM finishes, before the drag end events.
365 366 * @event ddm:end
366   - * @description Fires from the DDM after the DDM finishes, before the drag end events.
367 367 * @type {CustomEvent}
368 368 */
369 369
100 src/dd/js/ddm-drop.js
@@ -11,23 +11,23 @@
11 11 //TODO CSS class name for the bestMatch..
12 12 Y.mix(Y.DD.DDM, {
13 13 /**
  14 + * This flag turns off the use of the mouseover/mouseout shim. It should not be used unless you know what you are doing.
14 15 * @private
15 16 * @property _noShim
16   - * @description This flag turns off the use of the mouseover/mouseout shim. It should not be used unless you know what you are doing.
17 17 * @type {Boolean}
18 18 */
19 19 _noShim: false,
20 20 /**
  21 + * Placeholder for all active shims on the page
21 22 * @private
22 23 * @property _activeShims
23   - * @description Placeholder for all active shims on the page
24 24 * @type {Array}
25 25 */
26 26 _activeShims: [],
27 27 /**
  28 + * This method checks the _activeShims Object to see if there is a shim active.
28 29 * @private
29 30 * @method _hasActiveShim
30   - * @description This method checks the _activeShims Object to see if there is a shim active.
31 31 * @return {Boolean}
32 32 */
33 33 _hasActiveShim: function() {
@@ -37,127 +37,127 @@
37 37 return this._activeShims.length;
38 38 },
39 39 /**
  40 + * Adds a Drop Target to the list of active shims
40 41 * @private
41 42 * @method _addActiveShim
42   - * @description Adds a Drop Target to the list of active shims
43 43 * @param {Object} d The Drop instance to add to the list.
44 44 */
45 45 _addActiveShim: function(d) {
46   - this._activeShims[this._activeShims.length] = d;
  46 + this._activeShims.push(d);
47 47 },
48 48 /**
  49 + * Removes a Drop Target to the list of active shims
49 50 * @private
50 51 * @method _removeActiveShim
51   - * @description Removes a Drop Target to the list of active shims
52 52 * @param {Object} d The Drop instance to remove from the list.
53 53 */
54 54 _removeActiveShim: function(d) {
55 55 var s = [];
56   - Y.each(this._activeShims, function(v) {
  56 + Y.Array.each(this._activeShims, function(v) {
57 57 if (v._yuid !== d._yuid) {
58   - s[s.length] = v;
  58 + s.push(v);
59 59 }
60 60
61 61 });
62 62 this._activeShims = s;
63 63 },
64 64 /**
  65 + * This method will sync the position of the shims on the Drop Targets that are currently active.
65 66 * @method syncActiveShims
66   - * @description This method will sync the position of the shims on the Drop Targets that are currently active.
67 67 * @param {Boolean} force Resize/sync all Targets.
68 68 */
69 69 syncActiveShims: function(force) {
70 70 Y.later(0, this, function(force) {
71 71 var drops = ((force) ? this.targets : this._lookup());
72   - Y.each(drops, function(v) {
  72 + Y.Array.each(drops, function(v) {
73 73 v.sizeShim.call(v);
74 74 }, this);
75 75 }, force);
76 76 },
77 77 /**
  78 + * The mode that the drag operations will run in 0 for Point, 1 for Intersect, 2 for Strict
78 79 * @private
79 80 * @property mode
80   - * @description The mode that the drag operations will run in 0 for Point, 1 for Intersect, 2 for Strict
81 81 * @type Number
82 82 */
83 83 mode: 0,
84 84 /**
  85 + * In point mode, a Drop is targeted by the cursor being over the Target
85 86 * @private
86 87 * @property POINT
87   - * @description In point mode, a Drop is targeted by the cursor being over the Target
88 88 * @type Number
89 89 */
90 90 POINT: 0,
91 91 /**
  92 + * In intersect mode, a Drop is targeted by "part" of the drag node being over the Target
92 93 * @private
93 94 * @property INTERSECT
94   - * @description In intersect mode, a Drop is targeted by "part" of the drag node being over the Target
95 95 * @type Number
96 96 */
97 97 INTERSECT: 1,
98 98 /**
  99 + * In strict mode, a Drop is targeted by the "entire" drag node being over the Target
99 100 * @private
100 101 * @property STRICT
101   - * @description In strict mode, a Drop is targeted by the "entire" drag node being over the Target
102 102 * @type Number
103 103 */
104 104 STRICT: 2,
105 105 /**
  106 + * Should we only check targets that are in the viewport on drags (for performance), default: true
106 107 * @property useHash
107   - * @description Should we only check targets that are in the viewport on drags (for performance), default: true
108 108 * @type {Boolean}
109 109 */
110 110 useHash: true,
111 111 /**
  112 + * A reference to the active Drop Target
112 113 * @property activeDrop
113   - * @description A reference to the active Drop Target
114 114 * @type {Object}
115 115 */
116 116 activeDrop: null,
117 117 /**
  118 + * An array of the valid Drop Targets for this interaction.
118 119 * @property validDrops
119   - * @description An array of the valid Drop Targets for this interaction.
120 120 * @type {Array}
121 121 */
122 122 //TODO Change array/object literals to be in sync..
123 123 validDrops: [],
124 124 /**
  125 + * An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets)
125 126 * @property otherDrops
126   - * @description An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets)
127 127 * @type {Object}
128 128 */
129 129 otherDrops: {},
130 130 /**
  131 + * All of the Targets
131 132 * @property targets
132   - * @description All of the Targets
133 133 * @type {Array}
134 134 */
135 135 targets: [],
136 136 /**
  137 + * Add a Drop Target to the list of Valid Targets. This list get's regenerated on each new drag operation.
137 138 * @private
138 139 * @method _addValid
139   - * @description Add a Drop Target to the list of Valid Targets. This list get's regenerated on each new drag operation.
140 140 * @param {Object} drop
141 141 * @return {Self}
142 142 * @chainable
143 143 */
144 144 _addValid: function(drop) {
145   - this.validDrops[this.validDrops.length] = drop;
  145 + this.validDrops.push(drop);
146 146 return this;
147 147 },
148 148 /**
  149 + * Removes a Drop Target from the list of Valid Targets. This list get's regenerated on each new drag operation.
149 150 * @private
150 151 * @method _removeValid
151   - * @description Removes a Drop Target from the list of Valid Targets. This list get's regenerated on each new drag operation.
152 152 * @param {Object} drop
153 153 * @return {Self}
154 154 * @chainable
155 155 */
156 156 _removeValid: function(drop) {
157 157 var drops = [];
158   - Y.each(this.validDrops, function(v) {
  158 + Y.Array.each(this.validDrops, function(v) {
159 159 if (v !== drop) {
160   - drops[drops.length] = v;
  160 + drops.push(v);
161 161 }
162 162 });
163 163
@@ -165,8 +165,8 @@
165 165 return this;
166 166 },
167 167 /**
  168 + * Check to see if the Drag element is over the target, method varies on current mode
168 169 * @method isOverTarget
169   - * @description Check to see if the Drag element is over the target, method varies on current mode
170 170 * @param {Object} drop The drop to check against
171 171 * @return {Boolean}
172 172 */
@@ -200,8 +200,8 @@
200 200 return false;
201 201 },
202 202 /**
  203 + * Clears the cache data used for this interaction.
203 204 * @method clearCache
204   - * @description Clears the cache data used for this interaction.
205 205 */
206 206 clearCache: function() {
207 207 this.validDrops = [];
@@ -209,14 +209,14 @@
209 209 this._activeShims = [];
210 210 },
211 211 /**
  212 + * Clear the cache and activate the shims of all the targets
212 213 * @private
213 214 * @method _activateTargets
214   - * @description Clear the cache and activate the shims of all the targets
215 215 */
216 216 _activateTargets: function() {
217 217 this._noShim = true;
218 218 this.clearCache();
219   - Y.each(this.targets, function(v) {
  219 + Y.Array.each(this.targets, function(v) {
220 220 v._activateShim([]);
221 221 if (v.get('noShim') === true) {
222 222 this._noShim = false;
@@ -226,8 +226,8 @@
226 226
227 227 },
228 228 /**
  229 + * This method will gather the area for all potential targets and see which has the hightest covered area and return it.
229 230 * @method getBestMatch
230   - * @description This method will gather the area for all potential targets and see which has the hightest covered area and return it.
231 231 * @param {Array} drops An Array of drops to scan for the best match.
232 232 * @param {Boolean} all If present, it returns an Array. First item is best match, second is an Array of the other items in the original Array.
233 233 * @return {Object or Array}
@@ -235,7 +235,7 @@
235 235 getBestMatch: function(drops, all) {
236 236 var biggest = null, area = 0, out;
237 237
238   - Y.each(drops, function(v) {
  238 + Y.Array.each(drops, function(v) {
239 239 var inter = this.activeDrag.get('dragNode').intersect(v.get('node'));
240 240 v.region.area = inter.area;
241 241
@@ -249,9 +249,9 @@
249 249 if (all) {
250 250 out = [];
251 251 //TODO Sort the others in numeric order by area covered..
252   - Y.each(drops, function(v) {
  252 + Y.Array.each(drops, function(v) {
253 253 if (v !== biggest) {
254   - out[out.length] = v;
  254 + out.push(v);
255 255 }
256 256 }, this);
257 257 return [biggest, out];
@@ -259,9 +259,9 @@
259 259 return biggest;
260 260 },
261 261 /**
  262 + * This method fires the drop:hit, drag:drophit, drag:dropmiss methods and deactivates the shims..
262 263 * @private
263 264 * @method _deactivateTargets
264   - * @description This method fires the drop:hit, drag:drophit, drag:dropmiss methods and deactivates the shims..
265 265 */
266 266 _deactivateTargets: function() {
267 267 var other = [], tmp,
@@ -291,28 +291,28 @@
291 291
292 292 this.activeDrop = null;
293 293
294   - Y.each(this.targets, function(v) {
  294 + Y.Array.each(this.targets, function(v) {
295 295 v._deactivateShim([]);
296 296 }, this);
297 297 },
298 298 /**
  299 + * This method is called when the move method is called on the Drag Object.
299 300 * @private
300 301 * @method _dropMove
301   - * @description This method is called when the move method is called on the Drag Object.
302 302 */
303 303 _dropMove: function() {
304 304 if (this._hasActiveShim()) {
305 305 this._handleTargetOver();
306 306 } else {
307   - Y.each(this.otherDrops, function(v) {
  307 + Y.Array.each(this.otherDrops, function(v) {
308 308 v._handleOut.apply(v, []);
309 309 });
310 310 }
311 311 },
312 312 /**
  313 + * Filters the list of Drops down to those in the viewport.
313 314 * @private
314 315 * @method _lookup
315   - * @description Filters the list of Drops down to those in the viewport.
316 316 * @return {Array} The valid Drop Targets that are in the viewport.
317 317 */
318 318 _lookup: function() {
@@ -321,61 +321,61 @@
321 321 }
322 322 var drops = [];
323 323 //Only scan drop shims that are in the Viewport
324   - Y.each(this.validDrops, function(v) {
  324 + Y.Array.each(this.validDrops, function(v) {
325 325 if (v.shim && v.shim.inViewportRegion(false, v.region)) {
326   - drops[drops.length] = v;
  326 + drops.push(v);
327 327 }
328 328 });
329 329 return drops;
330 330
331 331 },
332 332 /**
  333 + * This method execs _handleTargetOver on all valid Drop Targets
333 334 * @private
334 335 * @method _handleTargetOver
335   - * @description This method execs _handleTargetOver on all valid Drop Targets
336 336 */
337 337 _handleTargetOver: function() {
338 338 var drops = this._lookup();
339   - Y.each(drops, function(v) {
  339 + Y.Array.each(drops, function(v) {
340 340 v._handleTargetOver.call(v);
341 341 }, this);
342 342 },
343 343 /**
  344 + * Add the passed in Target to the targets collection
344 345 * @private
345 346 * @method _regTarget
346   - * @description Add the passed in Target to the targets collection
347 347 * @param {Object} t The Target to add to the targets collection
348 348 */
349 349 _regTarget: function(t) {
350   - this.targets[this.targets.length] = t;
  350 + this.targets.push(t);
351 351 },
352 352 /**
  353 + * Remove the passed in Target from the targets collection
353 354 * @private
354 355 * @method _unregTarget
355   - * @description Remove the passed in Target from the targets collection
356 356 * @param {Object} drop The Target to remove from the targets collection
357 357 */
358 358 _unregTarget: function(drop) {
359 359 var targets = [], vdrops;
360   - Y.each(this.targets, function(v) {
  360 + Y.Array.each(this.targets, function(v) {
361 361 if (v !== drop) {
362   - targets[targets.length] = v;
  362 + targets.push(v);
363 363 }
364 364 }, this);
365 365 this.targets = targets;
366 366
367 367 vdrops = [];
368   - Y.each(this.validDrops, function(v) {
  368 + Y.Array.each(this.validDrops, function(v) {
369 369 if (v !== drop) {
370   - vdrops[vdrops.length] = v;
  370 + vdrops.push(v);
371 371 }
372 372 });
373 373
374 374 this.validDrops = vdrops;
375 375 },
376 376 /**
  377 + * Get a valid Drop instance back from a Node or a selector string, false otherwise
377 378 * @method getDrop
378   - * @description Get a valid Drop instance back from a Node or a selector string, false otherwise
379 379 * @param {String/Object} node The Node instance or Selector string to check for a valid Drop Object
380 380 * @return {Object}
381 381 */
@@ -383,7 +383,7 @@
383 383 var drop = false,
384 384 n = Y.one(node);
385 385 if (n instanceof Y.Node) {
386   - Y.each(this.targets, function(v) {
  386 + Y.Array.each(this.targets, function(v) {
387 387 if (n.compareTo(v.get('node'))) {
388 388 drop = v;
389 389 }
12 src/dd/js/ddm.js
@@ -10,16 +10,16 @@
10 10 */
11 11 Y.mix(Y.DD.DDM, {
12 12 /**
  13 + * The shim placed over the screen to track the mousemove event.
13 14 * @private
14 15 * @property _pg
15   - * @description The shim placed over the screen to track the mousemove event.
16 16 * @type {Node}
17 17 */
18 18 _pg: null,
19 19 /**
  20 + * Set this to true to set the shims opacity to .5 for debugging it, default: false.
20 21 * @private
21 22 * @property _debugShim
22   - * @description Set this to true to set the shims opacity to .5 for debugging it, default: false.
23 23 * @type {Boolean}
24 24 */
25 25 _debugShim: false,
@@ -37,17 +37,17 @@
37 37 this._deactivateTargets();
38 38 },
39 39 /**
  40 + * Deactivates the shim
40 41 * @private
41 42 * @method _pg_deactivate
42   - * @description Deactivates the shim
43 43 */
44 44 _pg_deactivate: function() {
45 45 this._pg.setStyle('display', 'none');
46 46 },
47 47 /**
  48 + * Activates the shim
48 49 * @private
49 50 * @method _pg_activate
50   - * @description Activates the shim
51 51 */
52 52 _pg_activate: function() {
53 53 if (!this._pg) {
@@ -71,9 +71,9 @@
71 71 });
72 72 },
73 73 /**
  74 + * Sizes the shim on: activatation, window:scroll, window:resize
74 75 * @private
75 76 * @method _pg_size
76   - * @description Sizes the shim on: activatation, window:scroll, window:resize
77 77 */
78 78 _pg_size: function() {
79 79 if (this.activeDrag) {
@@ -87,9 +87,9 @@
87 87 }
88 88 },
89 89 /**
  90 + * Creates the shim and adds it's listeners to it.
90 91 * @private
91 92 * @method _createPG
92   - * @description Creates the shim and adds it's listeners to it.
93 93 */
94 94 _createPG: function() {
95 95 var pg = Y.Node.create('<div></div>'),
52 src/dd/js/delegate.js
@@ -23,41 +23,41 @@
23 23
24 24 Y.extend(Delegate, Y.Base, {
25 25 /**
  26 + * The default bubbleTarget for this object. Default: Y.DD.DDM
26 27 * @private
27 28 * @property _bubbleTargets
28   - * @description The default bubbleTarget for this object. Default: Y.DD.DDM
29 29 */
30 30 _bubbleTargets: Y.DD.DDM,
31 31 /**
  32 + * A reference to the temporary dd instance used under the hood.
32 33 * @property dd
33   - * @description A reference to the temporary dd instance used under the hood.
34 34 */
35 35 dd: null,
36 36 /**
  37 + * The state of the Y.DD.DDM._noShim property to it can be reset.
37 38 * @property _shimState
38 39 * @private
39   - * @description The state of the Y.DD.DDM._noShim property to it can be reset.
40 40 */
41 41 _shimState: null,
42 42 /**
  43 + * Array of event handles to be destroyed
43 44 * @private