drop.js revision c8b61a25e72a46a8725ead6f5bbae7d00b502a33
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * The Drag & Drop Utility allows you to create a draggable interface efficiently, buffering you from browser-level abnormalities and enabling you to focus on the interesting logic surrounding your particular implementation. This component enables you to create a variety of standard draggable objects with just a few lines of code and then, using its extensive API, add your own specific implementation logic.
2ab6806f3c2a0800f4083d140805e3953eb469e6Ryan Grove * @module dd
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @submodule dd-drop
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * This class provides the ability to create a Drop Target.
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @class Drop
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @extends Base
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @constructor
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @event drop:over
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @description Fires when a drag element is over this target.
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @bubbles DDM
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @type Event.Custom
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @event drop:enter
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @description Fires when a drag element enters this target.
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @bubbles DDM
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @type Event.Custom
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @event drop:exit
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @description Fires when a drag element exits this target.
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @bubbles DDM
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @type Event.Custom
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @event drop:hit
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @description Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop)
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @bubbles DDM
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove * @type Event.Custom
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove Drop = function() {
06313be7b49422ae10a78e62a49ca8f8522491c4Ryan Grove Drop.superclass.constructor.apply(this, arguments);
node: {
groups: {
setter: function(g) {
this._groups = {};
Y.each(g, function(v, k) {
this._groups[v] = true;
padding: {
setter: function(p) {
lock: {
value: false,
if (lock) {
return lock;
* @description Controls the default bubble parent for this Drop instance. Default: Y.DD.DDM. Set to false to disable bubbling.
bubbles: {
writeOnce: true,
* @description This method creates all the events for this Event Target and publishes them so we get Event Bubbling.
_createEvents: function() {
var ev = [
this.publish(v, {
type: v,
emitFacade: true,
preventable: false,
bubbles: true,
queuable: false,
_valid: null,
_groups: null,
shim: null,
* @description A region object associated with this target, used for checking regions while dragging.
region: null,
overTarget: null,
this._valid = false;
var ret = false;
if (this._groups[v]) {
ret = true;
this._valid = true;
return ret;
initializer: function() {
destructor: function() {
if (this.shim) {
this.shim = null;
* @description Removes classes from the target, resets some flags and sets the shims deactive position [-999, -999]
_deactivateShim: function() {
if (!this.shim) {
this.overTarget = false;
_activateShim: function() {
this.overTarget = false;
this.sizeShim();
* @description Positions and sizes the shim with the raw data from the node, this can be used to programatically adjust the Targets shim for Animation..
sizeShim: function() {
if (!this.shim) {
this.region = {
_createShim: function() {
s.setStyles({
this.shim = s;
_handleTargetOver: function() {
if (this.overTarget) {
this.overTarget = true;
this._handleOut();
_handleOverEvent: function() {
_handleOutEvent: function() {
if (this.overTarget) {
this.overTarget = false;
if (!force) {