drop.js revision bef5bd55cae040389070d8db272d07e4d896997c
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * 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.
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @module dd
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @submodule dd-drop
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * This class provides the ability to create a Drop Target.
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @class Drop
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @extends Base
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @constructor
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @event drop:over
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @description Fires when a drag element is over this target.
43d14a760e0c8e57931be96b58b85e1e9fda778cMatt Sweeney * @bubbles DDM
var Drop = function() {
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) {