Skip to main content

Bug Tracker

Side navigation

#8741 closed bug (duplicate)

Opened April 01, 2011 01:56PM UTC

Closed May 02, 2011 01:41AM UTC

Last modified May 02, 2011 01:41AM UTC

.css("height") returns computed height

Reported by: Ivellina Owned by: Ivellina
Priority: low Milestone: 1.next
Component: css Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:
Description

As of version 1.5.1 and 1.5.2 .css("height") returns computed height instead of the style property height. For example :

<table id="anId" style="height: 200px">...

accessed by:

$("anId").css("height")

returns the real table size instead of 200px.

It works fine in version 1.3.2. The problem is always reproducible on Firefox 3.0.5 and IE 8 on Windows XP.

Attachments (0)
Change History (10)

Changed April 01, 2011 03:00PM UTC by timmywil comment:1

owner: → Ivellina
status: newpending

I created a test case based on your description and was unable to reproduce your issue. I checked in IE8. http://jsfiddle.net/timmywil/YxTn2/. Please provide a test case on jsfiddle or update mine to demonstrate the problem.

Changed April 01, 2011 04:27PM UTC by Ivellina comment:2

_comment0: Hi, \ \ Thanks for your quick response. \ \ I made an example to show you the problem we have. http://jsfiddle.net/FTjzm/1/ \ \ If you change the version in jsFiddle to 1.3.2 you will say that it prints the correct values. http://jsfiddle.net/FTjzm/3/ \ \ \ Ivelina \ \ \ 1301675298950683
_comment1: Hi, \ \ Thanks for your quick response. \ \ I made an example to show you the problem we have. http://jsfiddle.net/FTjzm/1/ \ \ \ Ivelina \ \ \ 1301675332736444
status: pendingnew

Hi,

Thanks for your quick response.

I made an example to show you the problem we have. http://jsfiddle.net/FTjzm/1/

If you change the version to 1.3.2 you will see that it works correctly.

Ivelina

Changed April 01, 2011 09:21PM UTC by timmywil comment:3

_comment0: → 1301692993876775
keywords: → needsreview
status: newopen
version: 1.5.11.5.2

After some investigation, it seems we are always using the computed in jQuery.css. This may be intended behavior.

Changed April 04, 2011 08:16AM UTC by Ivellina comment:4

If this is the intended behavior can you point me to the method I have to use in order to get the css height attribute?

Changed April 04, 2011 02:27PM UTC by timmywil comment:5

You will be able to use prop in 1.6, but for now you can use raw js. http://jsfiddle.net/timmywil/FTjzm/6/

Nevertheless, this still needs review as to whether always getting the computed value is intended behavior because I can't say for sure myself.

Changed April 05, 2011 07:42AM UTC by Ivellina comment:6

Thank you for your suggestion.

It works for us and we will apply it as a fix until we are waiting for version 1.6.

Changed April 15, 2011 04:53AM UTC by timmywil comment:7

component: unfiledcss
priority: undecidedlow

Changed April 22, 2011 01:36AM UTC by dmethvin comment:8

Yes it seems logical that .height() should return the height in pixels and .css("height") should return the non-computed CSS string (auto, 20em, etc.) for height. The problem is that other measurements (e.g., borderRightWidth) don't have a way to get computed vs. non-computed values via the jQuery API. It would be a serious problem IMO to return non-computed values for those.

I know it's been discussed quite a bit in the past but we need to document and justify why it works this way in the docs if it's to stay this way.

Changed May 02, 2011 01:41AM UTC by timmywil comment:9

keywords: needsreview
resolution: → duplicate
status: openclosed

Changed May 02, 2011 01:41AM UTC by timmywil comment:10

Duplicate of #7486.