Skip to content

InsertBefore breaking data binding, undefined parentNode #657

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

Closed
Billiam opened this issue Dec 27, 2014 · 2 comments
Closed

InsertBefore breaking data binding, undefined parentNode #657

Billiam opened this issue Dec 27, 2014 · 2 comments

Comments

@Billiam
Copy link

Billiam commented Dec 27, 2014

I'm trying to solve an odd problem, and thought I could work around it by manually adding some items to a directive's element:
http://jsbin.com/quxusu/2/edit?html,js,output

Which causes this error in a replace method:

 Uncaught TypeError: Cannot read property 'parentNode' of undefined

Is this a bug, or expected behavior?

@crswll
Copy link

crswll commented Dec 30, 2014

I tried it on nextTick and it appears to have worked http://jsbin.com/jizoho/1/edit

I was able to use jQuery's .append() without the nextTick as well, but not prepend(). I'm not sure if it's a bug or not but it might help someone out there.

@mk-relax
Copy link

I still have this problem, but then with a directive that reduces the number of children.

I'm implementing a v-ladda directive for 'ladda' buttons (Buttons with built-in loading indicators, https://github.com/hakimel/Ladda). In bind(), it changes the DOM by wrapping all children of a <button> in one <span> (I copied their code).

Wrapping one child works fine, but when wrapping multiple children (even text nodes resulting from newlines, which is annoying) Vue fails with the TypeError again.

See:
http://jsbin.com/cesuwo/edit?html,js,output

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

4 participants