Bug Tracker

Modify

Ticket #8584 (closed bug: plugin)

Opened 2 years ago

Last modified 2 years ago

Cannot remove clip CSS property from an element in IE

Reported by: j@… Owned by: j@…
Priority: undecided Milestone:
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocking: Blocked by:

Description

Hi there,

For a demonstration try the following example in IE:  http://jsfiddle.net/p5Ckf/

IE will throw an exception when el.style.clip = '' is set (which I think jQuery is catching, but either way, the clip is not unset).

IE <= 8 also does not support el.style.removeProperty, so the only way that I have been able to successfully remove the clip property is like so:

el.attr('style', el.attr('style').replace(/clip\: [^;]+;/i, ''))

(Eww.)

Note that you can set the clip property to 'auto'. This does not remove it, obviously, but can be useful in certain situations. Unfortunately in my use case I have descendent content with negative margins which still get clipped when clip is set to 'auto', so I really do need to remove the clip.

Thanks

Change History

comment:1 Changed 2 years ago by dmethvin

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

Use 'auto' instead of '', which is an invalid value for that property.

Last edited 2 years ago by dmethvin (previous) (diff)

comment:2 Changed 2 years ago by j@…

Hi,

I take that point that the empty string is an invalid value when applied directly via el.style.clip.

However, the real point is that I am trying to do $(el).css('clip', ''), which according to the jQuery docs at  http://api.jquery.com/css/, should work:

Setting the value of a style property to an empty string — e.g. $('#mydiv').css('color', '') — removes that property from an element

Setting the clip to auto has a different effect to removing the actual property completely - I explained this in my original post.

Please could you reopen the ticket?

Thanks

comment:3 Changed 2 years ago by dmethvin

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:4 Changed 2 years ago by dmethvin

  • Owner set to j@…
  • Status changed from reopened to pending

I'm reopening this, mainly because I think it might need to be closed cantfix. Do you have a proposal for how to fix this? If so please post it in jsFiddle. Otherwise I am not sure anything can be done about it.

comment:5 Changed 2 years ago by anonymous

Hi,

Thanks for reopening.

The regexp method in my original report will work. It's a nasty hack, but it works.

Jon

comment:6 Changed 2 years ago by anonymous

For other browsers we should obviously use el.style.removeProperty('clip').

comment:7 Changed 2 years ago by john

  • Status changed from pending to closed
  • Resolution set to plugin
  • Milestone 1.next deleted

This sounds like a good candidate for a plugin (using the new CSS Hook API).

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.