Skip to content
This repository

FF 16 TypeError #86

Closed
markusfalk opened this Issue October 16, 2012 · 8 comments

7 participants

Markus Falk Rico Sta. Cruz Michael Everett Riccardo Magliocchetti themepunch Boris Zbarsky Christopher Lewis
Markus Falk

worked in FF 15 but after updating to FF 16 I get the following error:

TypeError: h.setFromString is not a function

...ion(b){return(d(b).css("transform")||new j).get(a)},set:function(b,e){var h=d(b)...

here is the website: http://www.autobusoberbayern.de/de/startseite/

Michael Everett

So I just saw this one too and have a fix. Starting in FF16 sometimes $(elem).css('transform') returns a string with value "none" instead of null like it did in 15 and below. A string obviously does not have the h.setFromString() function. Here's the fix starting on line 590 (of the non-minifed version):

  $.cssHooks[prop] = {
        get: function (elem) {
            var t = $(elem).css('transform') || new Transform();
            if (t == "none") t = new Transform();
            return t.get(prop);
        },

        set: function (elem, value) {
            var t = $(elem).css('transform') || new Transform();
            if (t == "none") t = new Transform();
            t.setFromString(prop, value);

            $(elem).css({ transform: t });
        }
    };

Also I'm not sure if the fix should be 'if (t == "none") t = new Transform();' or 'if (typeof (t) == "string") t = new Transform();'... they both work. The '== "none"' option is very specific whereas that string value might change in future versions (it obviously changed form 15 to 16) but I hope the 'typeof (t) == "string"' version is not too broad. In theory though if a string is coming back it's useless no matter what.

Riccardo Magliocchetti

@meverett fix works for me. I'd really like to have a fixed version since i've added jquery.transit to cdnjs, so currently distributing a broken version with latest firefox.

themepunch

Hi,

This solution does not work for me at all.

This one does:

$.cssHooks[prop] = {
                get: function(elem) {
                    var et = $(elem).css('transform');
                    var t = (et && et != 'none') ? et : new Transform();
                    try {
                        return t.get(prop);
                    } catch (e) {}
                },
                set: function(elem, value) {

                    var et = $(elem).css('transform');
                    var t = (et && et != 'none') ? et : new Transform();
                    try {
                        //t.setFromString && t.setFromString(prop, value);
                        t.setFromString(prop, value);
                        $(elem).css({
                            transform: t
                        });
                    } catch (e) {}
                }
            };

But!! it is not working together with the isotope plugin in FF16. (Everywhere else yes). Tested it in jquery 1.7 - 1.8.2
I still looking for a 100% perfect solution where the jQuery transit plugin and isotope plugin works fine in FF16 !

Boris Zbarsky

The cited code is basically broken in any UA that supports the "transform" property without a prefix. The right fix is probably to not do the css('transform") thing at all, since that will query actual CSS properties and return the actual CSS transform (or "none" if there is no transform).

Christopher Lewis

Fixed this issue in Firefox v17 by updating the registerCssHook function as such:

function registerCssHook(prop, isPixels) {
    // For certain properties, the 'px' should not be implied.
    if (!isPixels) { $.cssNumber[prop] = true; }

    $.transit.propertyMap[prop] = support.transform;

    $.cssHooks[prop] = {
      get: function(elem) {
        var t = $(elem).css('transform') || new Transform();
        return t.get(prop);
      },

      set: function(elem, value) {
        var t = $(elem).css('transform') || new Transform();

        try {
            t.setFromString(prop, value);
        } catch (e) {}

        $(elem).css({ transform: t });
      }
    };
  }
themepunch
Rico Sta. Cruz rstacruz closed this December 13, 2012
Rico Sta. Cruz
Owner

No need for that fix now—v0.9.9+ should be fine.

themepunch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.