Skip to main content

Bug Tracker

Side navigation

#2096 closed bug (fixed)

Opened December 27, 2007 07:50AM UTC

Closed December 27, 2007 01:31PM UTC

ui.mouse: appendTo broken

Reported by: wehriam Owned by: paul
Priority: major Milestone: 1.2.2
Component: ui 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 (2)

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