FF 16 TypeError #86

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

Comments

Projects
None yet
7 participants

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/

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.

xrmx commented Oct 19, 2012

@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.

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 !

bzbarsky commented Nov 1, 2012

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).

lewsid commented Nov 21, 2012

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 });
      }
    };
  }

Thanks a lot for your update !! Really appreciate it !

Cheers,

Krisztian

On Wed, Nov 21, 2012 at 9:36 PM, Christopher Lewis <notifications@github.com

wrote:

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 });
  }
};

}


Reply to this email directly or view it on GitHubhttps://github.com/rstacruz/jquery.transit/issues/86#issuecomment-10613282.

Cheers from your Team @ ThemePunch

http://www.themeforest.net/user/themepunch?ref=themepunch
http://www.twitter.com/themepunch
http://www.youtube.com/user/ThemePunch

@rstacruz rstacruz closed this Dec 14, 2012

Owner

rstacruz commented Dec 14, 2012

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

Wow ! Great news ! I tested it on some installation already and it works
great.

I found earlier also some conflict with the Foundation plugin and with the
Widgetkit plugin.
I just preparing a labor to test them now also. I will let you know if
there is any issue.

Thanks again for this great support !

Cheers,

Krisztian

On Fri, Dec 14, 2012 at 8:43 AM, Rico Sta. Cruz notifications@github.comwrote:

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


Reply to this email directly or view it on GitHubhttps://github.com/rstacruz/jquery.transit/issues/86#issuecomment-11367704.

Cheers from your Team @ ThemePunch

http://www.themeforest.net/user/themepunch?ref=themepunch
http://www.twitter.com/themepunch
http://www.youtube.com/user/ThemePunch

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