Skip to main content

Bug Tracker

Side navigation

#7976 closed bug (duplicate)

Opened January 14, 2011 09:06PM UTC

Closed January 14, 2011 10:07PM UTC

Last modified January 14, 2011 10:07PM UTC

calling position() on dom elements in memory throws TypeError

Reported by: Owned by:
Priority: low Milestone:
Component: offset Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

OS tested: win7, OS 10.5

Browsers tested: FF 3.6.13, IE7 & 8; broken on all.

Broken in jQuery 1.4.4 and 1.4.3; 1.4.2 seems to work as expected.


Calling .position() on dom elements that only exist in memory, i.e. that haven't been rendered yet, throws an exception. In <= 1.4.2, it returned a map with top,left = 0, which seems preferable.


(See jsfiddle case)

1. Execute the following at any time:

var position = $("<div/>").position()


"position" variable is assigned a map with top/left properties set to 0


Exception is thrown:

name: TypeError

message: setting a property that has only a getter


()@http: //
((function (j, s) {return new (b.fn.init)(j, s);}))@http: //
((function () {try {var position = $("<div/>").position();console.log(position);} catch (err)
{console.log(err);}}))@http: //
([object Object])@http ://
([object Object])@http ://
([object Event])@http ://
Attachments (0)
Change History (3)

Changed January 14, 2011 09:56PM UTC by rwaldron comment:1

component: unfiledoffset
priority: undecidedlow
status: newopen


" -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; "

Changed January 14, 2011 10:07PM UTC by rwaldron comment:2

resolution: → duplicate
status: openclosed

Changed January 14, 2011 10:07PM UTC by rwaldron comment:3

Duplicate of #7602.