julianshapiro/velocity

Chaining produces error "e.replace is not a function."

crackwilding opened this issue · 1 comments

Your system information

  • VelocityJS version: 2.06
  • Browser: Chrome
  • Operating System: OSX

I have code in a class that looks like this:

    this.image.velocity('property', { 
      left: (mousepos[0] - 6) + 'px',
      top: (mousepos[1] - 24) + 'px',
      opacity: 1
    }).velocity(
      { 
        left: (mousepos[0] - 6 + dest[0]) + 'px',
        top: (mousepos[1] - 24 - dest[1]) + 'px',
        opacity: 0
      },
      { duration: 3000 }
    );

When I run it it tells me "Uncaught TypeError: e.replace is not a function." This is in velocity.min.js, line 6, and the stack shows calling function as the second velocity call above. mousepos is a two-element array of screen x and y, as is dest. If I take out the opacity value in the second call, it works fine.

This will get fixed in v3, but the heart of the issue is that all css properties are actually strings - and somehow I skipped checking and fixing it in some circumstances - a quick fix would be to use opacity: "0", - but this is definitely a bug that needs handling (and testing for!)