Bug Tracker

Modify

Ticket #8346 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

jQuery.camelCase() & jQuery.css() incompatible with IE prefixed properties

Reported by: lrbabe Owned by: lrbabe
Priority: low Milestone: 1.5.2
Component: css Version: 1.5.1rc1
Keywords: Cc:
Blocking: Blocked by:

Description

My computer is too old to install Vista and IE9 in a VM, but I'm pretty sure that this fiddle will fail in IE9:  http://jsfiddle.net/AqxWY/1

The reason is that Microsoft exposes it's vendor prefixed properties as elem.style.msTranform instead of elem.style.MsTransform The regular expressions that succesfully convert -moz-transform to MozTransform and vice versa are failing in IE9.

I doubt that we can ask Microsoft to fix their browser now that it's in RC, but we could ask them to mirror all their current properties to the correct ones like Webkit does (both webkitTransform and WebkitTransform work). Otherwise we might have to apply a dirty patch to our regexps...

Although cssHooks handle browser normalization, most of them rely on jQuery.css() to get the computed value of the vendor prefixed property and thus fail in IE9.

Louis-Rémi

Change History

comment:1 Changed 3 years ago by lrbabe

If we get this fixed, we could even simplify cssHooks by filling only the jQuery.cssProps object.

Note that fixing jQuery.camelCase is not crucial anyway, as I don't expect much developers to create IE specific code such as:

$('#div').style('-ms-transform', 'translate(10px, 10px)');

comment:2 Changed 3 years ago by jitter

  • Owner set to lrbabe
  • Priority changed from undecided to low
  • Status changed from new to pending
  • Component changed from unfiled to css
  • Milestone 1.next deleted

After checking your report and trying your test case with IE9RC I can only partially reproduce your issue.

With this  test case I verified that passing -ms-transform and MsTransform to .css() both work when reading. And that passing msTransform actually doesn't work.

That's because css() uses curCSS() which in IE9 is getComputedStyle and thus actually looks for computedStyle.getPropertyValue( name ) (where name is -ms-transform).

The output when accessing -ms-transform/MsTransform with css() is matrix(1, 0, 0, 1, 10, 10) in both cases. When accessing msTransform no value is returned.

Although when you try to set a value via .css() both -ms-transform and MsTransform fail and msTransform works. As internally style[ name ] = value is done (where name is MsTransform). But providing a set-cssHook for MsTransform makes it possible to workaround this issue (see my test case).

So I think this is a non-issue, will close if you confirm.

comment:3 Changed 3 years ago by lrbabe

  • Status changed from pending to new

My first comment was important, but not very clear I concede.

You can implement cheap cssHooks for modern browsers using only the jQuery.cssProps properties, here is an example for the text-shadow property:  http://jsfiddle.net/PKnFZ/4/

This hook works great in Firefox, Chrome and Safari. But it will fail in IE no matter what form of the property is set to cssProps: "-ms-box-shadow" and "MsBoxShadow" will fail when setting style, "msBoxShadow" will fail when getting computed style.

Moreover, deciding which form of the property to use in cssHooks can be confusing. Authors might want to access the raw DOM in their plugin, and sometime use jQuery methods.

I'll open a pull request to fix jQuery.camelCase(), but it might be worth trying to contact the IE team and see what they can do.

Lr

comment:4 Changed 3 years ago by lrbabe

oops, it's not jQuery.camelCase() that needs to be fixed, only the "rupper" regular expression used in jQuery.css()

comment:5 Changed 3 years ago by lrbabe

comment:6 Changed 3 years ago by addyosmani

  • Status changed from new to open

comment:7 Changed 3 years ago by john

  • Status changed from open to closed
  • Resolution set to fixed
  • Milestone set to 1.5.2

Landed.

comment:8 Changed 3 years ago by Kevin Decker <kpdecker@…>

Testing with 1.5.2 it is still not possible to set these styles using the "-ms-*" names. "ms*" work properly.

 http://jsfiddle.net/kpdecker/c72m4/1/

While there is a work around it seems that this may cause some confusion for developers who are used to using the -vendor- notation when setting these properties.

comment:9 Changed 3 years ago by anonymous

I have same issue with css. ms-* have to be used instead of -ms-*. maybe the ticket should be reopened?

comment:10 Changed 3 years ago by CoryDorning

Same issue as .

Not working in 1.5.2 for me either.

comment:11 Changed 3 years ago by anonymous

Same as above, in 1.6.2. msTransform works, -ms-transform doesn't

comment:12 Changed 3 years ago by rwaldron

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.