Bug Tracker

Ticket #1843 (closed bug: fixed)

Opened 1 year ago

Last modified 1 year ago

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

Reported by: DanSwitzer2 Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.2.2 Component: core
Version: 1.2.1 Keywords:
Cc: Needs: Review

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

Change History

Changed 1 year ago by DanSwitzer2

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

Changed 1 year ago by brandon

  • status changed from new to closed
  • resolution set to fixed

Fixed in Rev [4100].

Note: See TracTickets for help on using tickets.