Draggable: Using this.document and this.window instead of doc/win

This commit is contained in:
Corey Frang 2011-10-27 21:39:33 -05:00
parent ec846fb723
commit f7ec502992

View File

@ -150,7 +150,7 @@ $.widget( "ui.draggable", {
this.dragEl this.dragEl
// TODO: should we move this to the stylesheet and use a class? // TODO: should we move this to the stylesheet and use a class?
.css( "position", "absolute" ) .css( "position", "absolute" )
.appendTo( this.doc[0].body ) .appendTo( this.document[0].body )
.offset( this.element.offset() ); .offset( this.element.offset() );
} }
@ -170,17 +170,17 @@ $.widget( "ui.draggable", {
}; };
// Cache the offset of scrollParent, if required for _handleScrolling // Cache the offset of scrollParent, if required for _handleScrolling
if ( this.scrollParent[0] != this.doc[0] && this.scrollParent[0].tagName != 'HTML') { if ( this.scrollParent[0] != this.document[0] && this.scrollParent[0].tagName != 'HTML') {
this.overflowOffset = this.scrollParent.offset(); this.overflowOffset = this.scrollParent.offset();
} }
this.overflow = {}; this.overflow = {};
this.overflow.height = ( this.scrollParent[0] === this.doc[0] ) ? this.overflow.height = ( this.scrollParent[0] === this.document[0] ) ?
this.win.height() : this.scrollParent.height(); this.window.height() : this.scrollParent.height();
this.overflow.width = ( this.scrollParent[0] === this.doc[0] ) ? this.overflow.width = ( this.scrollParent[0] === this.document[0] ) ?
this.win.width() : this.scrollParent.width(); this.window.width() : this.scrollParent.width();
this._preparePosition( event ); this._preparePosition( event );
@ -189,13 +189,13 @@ $.widget( "ui.draggable", {
// TODO: should user be able to change position of draggable, if event stopped? // TODO: should user be able to change position of draggable, if event stopped?
// If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes // If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes
if ( event.cancelBubble === true ) { if ( event.cancelBubble === true ) {
this.doc.unbind( "." + this.widgetName ); this.document.unbind( "." + this.widgetName );
return; return;
} }
this._setCss( event ); this._setCss( event );
this._bind( this.doc, { this._bind( this.document, {
mousemove: "_mouseMove", mousemove: "_mouseMove",
mouseup: "_mouseUp" mouseup: "_mouseUp"
}); });
@ -211,7 +211,7 @@ $.widget( "ui.draggable", {
// TODO: should user be able to change position of draggable, if event stopped? // TODO: should user be able to change position of draggable, if event stopped?
// If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes // If user stops propagation, leave helper there ( if there's one ), disallow any CSS changes
if ( event.cancelBubble === true ) { if ( event.cancelBubble === true ) {
this.doc.unbind( "." + this.widgetName ); this.document.unbind( "." + this.widgetName );
return; return;
} }
@ -239,7 +239,7 @@ $.widget( "ui.draggable", {
} }
this.doc.unbind( "." + this.widgetName ); this.document.unbind( "." + this.widgetName );
}, },
// Uses event to determine new position of draggable, before any override from callbacks // Uses event to determine new position of draggable, before any override from callbacks