Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#8346 closed bug (fixed)

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


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.


Change History (12)

comment:1 Changed 12 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 12 years ago by jitter

Component: unfiledcss
Milestone: 1.next
Owner: set to lrbabe
Priority: undecidedlow
Status: newpending

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 12 years ago by lrbabe

Status: pendingnew

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.


comment:4 Changed 12 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 12 years ago by lrbabe

comment:6 Changed 12 years ago by addyosmani

Status: newopen

comment:7 Changed 12 years ago by john

Milestone: 1.5.2
Resolution: fixed
Status: openclosed


comment:8 Changed 12 years ago by Kevin Decker <[email protected]…>

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


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 12 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 12 years ago by CoryDorning

Same issue as .

Not working in 1.5.2 for me either.

comment:11 Changed 12 years ago by anonymous

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

comment:12 Changed 12 years ago by Rick Waldron

Note: See TracTickets for help on using tickets.