delegate.js revision 482da2d388e0f999f372383039af944e21bc717b
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @module dd
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @submodule dd-delegate
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @class Delegate
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @extends Base
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @constructor
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @namespace DD
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai var Delegate = function(o) {
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai Delegate.superclass.constructor.apply(this, arguments);
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai _tmpNode = Y.Node.create('<div>Temp Node</div>');
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @property dd
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @description A reference to the temporary dd instance used under the hood.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @property _shimState
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @description The state of the Y.DD.DDM._noShim property to it can be reset.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @method _onNodeChange
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @description Listens to the nodeChange event and sets the dragNode on the temp dd instance.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @param {Event} e The Event.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @method _afterDragEnd
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @description Listens for the drag:end event and updates the temp dd instance.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @param {Event} e The Event.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai self.get('lastNode').removeClass(Y.DD.DDM.CSS_PREFIX + '-dragging');
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @method _onDelegate
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @description The callback for the Y.DD.Delegate instance used
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @param {Event} e The MouseDown Event.
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai _onDelegate: function(e) {
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai if (tar.test(self.get(NODES)) && !tar.test(self.get('invalid'))) {
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @method _onMouseEnter
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @description Sets the target shim state
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @param {Event} e The MouseEnter Event
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @method _onMouseLeave
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @description Resets the target shim state
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai * @param {Event} e The MouseLeave Event
6c96442b6a372e466ea59417a4e147d4fbd4a006Satyen Desai //Create a tmp DD instance under the hood.
if (group) {
return self;
var config = {
useShim: false,
bubbleTargets: this
return node;
destructor: function() {
if (this.dd) {
ATTRS: {
* @description A selector query to get the container to listen for mousedown events on. All "nodes" should be a child of this container.
container: {
* @description A selector query to get the children of the "container" to make draggable elements from.
nodes: {
invalid: {
lastNode: {
currentNode: {
dragNode: {
over: {
value: false
target: {
value: false
dragConfig: {
value: null
handles: {
value: null
_delegates: [],
var del = null;
del = v;
return del;