Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read property 'replace' in some initial conditions #127

Open
PhantomYdn opened this issue May 21, 2015 · 1 comment
Open

Can't read property 'replace' in some initial conditions #127

PhantomYdn opened this issue May 21, 2015 · 1 comment

Comments

@PhantomYdn
Copy link

Hi!

Sometime ShapeShift fire "Can't read property 'replace'" error. Please take a look into example:
http://jsfiddle.net/phantomydn/29Lmnkes/

@infinityplusone
Copy link

It looks like the problem here is that getPositions is, sometimes, returning an array with undefined values (because it pushing values into the positions array via positions[child.i] =. The downstream result is that the value of attributes in arrange is undefined, and jQuery is puking on using that to update an element's CSS.

I haven't fully followed the path of everything going on, but one really hacky fix would be to add this after attributes = child_positions[i];:

if(typeof attributes==='undefined') {
    attributes = {};
}

Alternately, we could check that the array returned by getPositions doesn't contain any undefined values, and clean it up before it gets there. That seems to work well too, but I decided to go with the "simpler" solution for myself.

Both solutions work for me. Since this appears to be a race condition of some sort (or perhaps just bad timing), it probably requires a deeper solution to be solved correctly, but I'm happy with it as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants