Detect "transform-style: preserve-3d" support, or update csstransforms3d for IE10 ? #762

bitinn opened this Issue Dec 4, 2012 · 21 comments


None yet
bitinn commented Dec 4, 2012

Didn't find a report for this issue, apologize if dup.

This is a problem because IE10 comes out with strong supports for most transform properties/functions (un-prefixed), but a heart-breaking exception:

transform-style: preserve-3d;

It only supports the default 'flat' value, so unlike Opera or IE9, 3d transforms does not fallback gracefully, but animate incorrectly if any part of rules require child rotating relative to parent (e.g. rotate3d on both parent and child).

I am not sure whether updating csstransforms3d (currently only check for perspective support, which IE10 does support) or creating a new test is more appropriate, but this gist seems to be a good starting point:


stucox commented Dec 30, 2012

+1 for a new test, or at least a new sub-test (e.g. csstransform3d.preserve3d) - it'd be unfair on IE10 to brand it as not supporting 3D transforms, yet this sounds like a major enough barrier to warrant detection.


Hmm interesting I had no idea IE10 didn't support that. I think a new test that either hangs off of the existing property, like @stucox mentions above, or just name a new feature detect all together. I'm leaning towards a new test as we can avoid new Boolean ctor ugliness.

3.0 is about to drop at any moment and changes how detects a done slightly, we'll hold off until that comes.


+1 for this issue. Missing it so much. And the gist mentioned above seem not to work for me - Chrome reports false, while it supports this feature. Although, Firefox reports true as expected.

(function getPerspective(){
  var element = document.createElement('p'),
      html = document.getElementsByTagName('HTML')[0],
      body = document.getElementsByTagName('BODY')[0],
      propertys = {

    body.insertBefore(element, null);

    for (var i in propertys) {
        if ([i] !== undefined) {
  [i] = "preserve-3d";

    var st = window.getComputedStyle(element, null),
        transform = st.getPropertyValue("-webkit-transform-style") ||
                    st.getPropertyValue("-moz-transform-style") ||
                    st.getPropertyValue("-ms-transform-style") ||

      html.className += 'no-preserve-3d';


May work :)

stucox commented Apr 20, 2013

I think we can massively simplify this using the new extensions to testAllProps() currently sitting on the supports branch:

define(['Modernizr', 'testAllProps'], function (Modernizr, testAllProps) {
  Modernizr.addTest('preserve3d', testAllProps('transformStyle', 'preserve-3d'));

true in Chrome 26.0, false in IE10...

(Sorry, this new API hasn't really been publicised yet, we're still working out the details, but essentially the plan is to allow a specific value of a property to be tested, with syntax similar to that above. Property names are still automatically prefixed. It'll use native feature detection where available.)


Thanks guys!

@SilentImp Yeah, this seems to be working)

@stucox Didn't know about this api, thanks! Although, it didn't work for me now, probably because i'm using the version off the main branch, which i took from the site. But i'll look into it, thanks!


+1. This is really essential to have.

clanam commented Jul 31, 2013

+1 want...




there's an open PR that we're waiting on some updates for at #999



@paulirish paulirish closed this in 3d7d05e Nov 6, 2013

There is a peculiar case of when the browser reports that it "supports" preserve-3d, but actually doesn't. Reproduces on most linux machines in Google Chrome.

The thing is that it does not render preserve-3d on some hardware.

See this test case: -- on my machine (see the configuration here: jmpressjs/jmpress.js#133) it says "Looks like we have preserve-3d support - you should see red text below", but the red text itself is not visible.

I do realize that this is likely a bug to be reported to Webkit/Chromium, but it could take ages before it's fixed, and everyone has updated. So a workaround is a good idea.


@drygiel @paulirish will you look into this a little?


Would you mind opening up a new issue so we don't loose track of your comments?

That being said, I am assuming you are hitting places where either chrome doesn't support the GPU, or the GPU is crashing whilst rendering.


@patrickkettner thanks, there it is: #1116


@rogertheshrubber not sure what you are +1ing here. The original issue was fixed months ago. Could you let me know?



Sorry for the confusion. I'd like to see the preserve-3d test added to Modernizr. It's also a problem in IE11.


What does 3d7d05e not fix for you?


Modernizr.testAllProps('transformStyle', 'preserve-3d')
falsely reports true for me in IE 11(.0.9600).

I thought this was fixed, is this a bug, or am I doing something wrong? I'm using Modernizr 2.7.1.

stucox commented Apr 8, 2014

@pocketjoso The 2-param syntax for testAllProps() doesn't work in v2.x I'm afraid, it only comes in with v3.0.0.

If you like living on the edge, you could try creating a v3.0.0pre Modernizr build at

@patrickkettner patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
@edmellum edmellum Add 'transform-style: preserve-3d' test - fixes #762 fb564aa
@mxklb mxklb referenced this issue in codeSessionsP2/masimapage Jan 10, 2016

Browser Feature Detection / Fallback Solution #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment