Bug Tracker

Modify

Ticket #6287 (closed bug: wontfix)

Opened 3 years ago

Last modified 2 years ago

show() hide() bug if element is hidden with css class property

Reported by: orensol Owned by:
Priority: undecided Milestone:
Component: css Version: 1.4.2
Keywords: css, show, hide Cc:
Blocking: Blocked by:

Description

If an element is hidden with a css class, and then you call show() and hide() on the element, it remains with a new style property of "style = 'display: none;'".

This behavior can be unwanted in some cases. hide() in this case should remove the "display" property that was added to the style attribute.

Attachments

test-hide.html Download (380 bytes) - added by orensol 3 years ago.

Change History

comment:1 Changed 3 years ago by seasoup

Can you provide a test case?

Changed 3 years ago by orensol

comment:2 Changed 3 years ago by orensol

Attached test-hide.html, notice how the img is first hidden with the css class .hid, and after show().hide() is called, it is hidden with the element.style.

comment:3 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

This is intentional. Although it's easy to get the element's css display property, it is harder to know whether it's from a stylesheet or an inline style. Is there some situation where the current behavior breaks something?

comment:4 Changed 3 years ago by orensol

  • Status changed from closed to reopened
  • Resolution worksforme deleted

Yes, this behavior breaks something.

If that element is hidden because a parent element is hidden, and you have code that somewhere along the way shows the parent element, this child element remains hidden, although the expected result would be it is shown.

Also, it's not that hard to know if the style is inline. (obj.attr('style').indexOf('display') > -1) should do the trick.

comment:5 Changed 3 years ago by snover

  • Milestone 1.4.3 deleted

Resetting milestone to future.

comment:6 Changed 2 years ago by snover

  • Priority set to undecided
  • Status changed from reopened to closed
  • Resolution set to wontfix

Calling hide, show, css, etc. always implies a style override.

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.