Skip to main content

Search and Top Navigation

#2096 closed bug (fixed)

Opened December 27, 2007 07:50AM UTC

Closed December 27, 2007 01:31PM UTC

Last modified February 26, 2009 11:21AM UTC

ui.mouse: appendTo broken

Reported by: wehriam Owned by: paul
Priority: major Milestone: 1.5
Component: ui.core Version: 1.2.1
Keywords: mouse draggable Cc:
Blocked by: Blocking:
Description

Lines 141-142 in UI mouse in rev 4311:

			if(o.appendTo == 'parent') { // Let's see if we have a positioned parent
				var cp = a.parentNode;
				while (cp) {
					if(cp.style && ($(cp).css('position') == 'relative' || $(cp).css('position') == 'absolute')) {
						o.pp = cp;
						o.po = $(cp).offset();
						o.ppOverflow = !!($(o.pp).css('overflow') == 'auto' || $(o.pp).css('overflow') == 'scroll'); //TODO!
						break;	
					}
					cp = cp.parentNode ? cp.parentNode : null;
				};
				
				if(!o.pp) o.po = { top: 0, left: 0 };
			}

If "appendTo" is specified (for example when using a draggable) the this.options.po object goes unset. This causes problems in ui.draggable and likely elsewhere.


			if(o.appendTo == 'parent') { // Let's see if we have a positioned parent
				var cp = a.parentNode;
				while (cp) {
					if(cp.style && ($(cp).css('position') == 'relative' || $(cp).css('position') == 'absolute')) {
						o.pp = cp;
						o.po = $(cp).offset();
						o.ppOverflow = !!($(o.pp).css('overflow') == 'auto' || $(o.pp).css('overflow') == 'scroll'); //TODO!
						break;	
					}
					cp = cp.parentNode ? cp.parentNode : null;
				};
				
				if(!o.pp) o.po = { top: 0, left: 0 };
			} else { 
				var cp = $(o.appendTo)[0];
				while (cp) {
					if(cp.style && ($(cp).css('position') == 'relative' || $(cp).css('position') == 'absolute')) {
						o.pp = cp;
						o.po = $(cp).offset();
						o.ppOverflow = !!($(o.pp).css('overflow') == 'auto' || $(o.pp).css('overflow') == 'scroll'); //TODO!
						break;	
					}
					cp = cp.parentNode ? cp.parentNode : null;
				};

				if(!o.pp) o.po = { top: 0, left: 0 };
			}

This seems to fix the problem. Sorry - for the time being I am not familiar enough with the codebase to give a more elegant solution.

Attachments (0)
Change History (4)

Changed December 27, 2007 01:31PM UTC by paul comment:1

owner: → paul
status: newassigned

You're absolutely right. Thanks for pointing it out. It's fixed in the upcoming version.

Changed December 27, 2007 01:31PM UTC by paul comment:2

resolution: → fixed
status: assignedclosed

Changed May 24, 2008 03:39AM UTC by comment:3

milestone: 1.2.2

Milestone 1.2.2 deleted

Changed February 26, 2009 11:21AM UTC by paul comment:4

milestone: → 1.5