Skip to main content

Bug Tracker

Side navigation

#1843 closed bug (fixed)

Opened October 24, 2007 08:27PM UTC

Closed December 11, 2007 04:45AM UTC

Calling width/height() on a hidden element causes cursor to move to the end of textarea

Reported by: DanSwitzer2 Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:
Description

There appears to be an issue in Firefox v2.0.0.8 and the width/height() methods.

If you call them on an element which is hidden and the user is typing in a textarea box, then the cursor jumps to the end of the textarea box.

This does not happen with the css() method.

I've prepared a page that demonstrates the behavior:

http://www.pengoworks.com/workshop/jquery/jquery_height_issue.htm

If you make the hidden div visible, it works as expected. If you use the css() method it works as expected.

Some more digging, it appears the problem only exists when the hidden element is a child of the body tag.

I've tracked the problem down to the jQuery.css function. If you change the lines:

if ( parPos == "static" )

e.parentNode.style.position = "relative";

to:

if ( parPos == "static" && e.parentNode.tagName != "BODY" )

e.parentNode.style.position = "relative";

This seems to resolve the problem. Apparently changing the position of the BODY tag in FF causes some kind of document reset.

Attachments (0)
Change History (2)

Changed October 25, 2007 02:06AM UTC by DanSwitzer2 comment:1

This appears to be related to #1415 and http://dev.jquery.com/ticket/1629#1629

Changed December 11, 2007 04:45AM UTC by brandon comment:2

resolution: → fixed
status: newclosed

Fixed in Rev [4100].