Bug Tracker

Modify

Ticket #6714 (closed enhancement: patchwelcome)

Opened 3 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

Description

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

Change History

comment:1 Changed 3 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 3 years ago by dmethvin

  • Component changed from unfiled to css
  • Summary changed from IE Bug with css to css display property of table row returns undefined

comment:3 Changed 3 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 3 years ago by SlexAxton

  • Priority set to low
  • Status changed from new to open
  • Type changed from bug to enhancement

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 3 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 3 years ago by snover

  • Milestone 1.4.3 deleted

Resetting milestone to future.

comment:7 Changed 2 years ago by john

  • Status changed from open to closed
  • Resolution set to patchwelcome

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.