digitarald / digitarald-fancyupload

Swiff meets Ajax for powerful and elegant uploads (MooTools Plugin).
http://digitarald.de/project/fancyupload/
277 stars 105 forks source link

Logic bug in reposition() #13

Open natedub opened 14 years ago

natedub commented 14 years ago

There's a small operator precedence problem in reposition() that causes the function to throw an error when this.target == null. The ternary operator in this statement:

coords = coords || (this.target && this.target.offsetHeight)
    ? this.target.getCoordinates(this.box.getOffsetParent())
    : {top: window.getScrollTop(), left: 0, width: 40, height: 40};

needs to be wrapped in parentheses:

coords = coords || ((this.target && this.target.offsetHeight)
    ? this.target.getCoordinates(this.box.getOffsetParent())
    : {top: window.getScrollTop(), left: 0, width: 40, height: 40});