Bug Tracker

Opened 13 years ago

Closed 12 years ago

#6714 closed enhancement (patchwelcome)

css display property of table row returns undefined

Reported by: sdoony Owned by:
Priority: low Milestone:
Component: css Version: 1.4.2
Keywords: IE css undefined Cc:
Blocked by: Blocking:

Description

example: $('<tr></tr>').css('display'); returns undefined in a previous version of jquery 'block' was returned. Tested this with IE 8.

Change History (7)

comment:1 Changed 13 years ago by dmethvin

In IE8, document.createElement("tr").style.display returns an empty string. The default display type of a tr is implicitly table-row. Seems like display should return an empty string rather than undefined.

comment:2 Changed 13 years ago by dmethvin

Component: unfiledcss
Summary: IE Bug with csscss display property of table row returns undefined

comment:3 Changed 12 years ago by boushley

Here is a fiddle displaying the behavior described http://jsfiddle.net/boushley/wuLRT/2/ However, I think the issue has more to do with the fact that the element isn't added to the DOM yet and so we're not quite sure on what the display property is at this point. I think returning an empty string is perfectly valid for an element that's been created an not added to the DOM.

The fiddle also shows that the behavior is similar to that of a div element, and so there is no special case happening here for tr elements.

comment:4 Changed 12 years ago by SlexAxton

Priority: low
Status: newopen
Type: bugenhancement

It should be consistent, whatever it is. Perhaps this should be an enhancement for 'consistently returning display values for elements not in the dom'

It's probably not very high on the list, but worth adding to the queue, likely.

comment:5 Changed 12 years ago by sdoony

Thank you. I agree that consistency would be the most important thing across different versions. I originally submitted this because I was using the script to determine how a particular browser assigned the display css attribute.

comment:6 Changed 12 years ago by snover

Milestone: 1.4.3

Resetting milestone to future.

comment:7 Changed 12 years ago by john

Resolution: patchwelcome
Status: openclosed

I don't think that this is something that we're going to be able to reasonably resolve - it doesn't seem like any technique that we can do will work, even with the latest improvement. https://github.com/jquery/jquery/commit/1dda994c463f01977c7126407998d61efed218a5

Patches are welcome.

Note: See TracTickets for help on using tickets.