Skip to content

Conversation

wprater
Copy link

@wprater wprater commented Jun 23, 2014

If there is only 1 item in the collection, don't bother checking for other elements. nextEl does not exists and causes an exception.

I assume this would not affect a change in the model where a new collection also has a size of one, but it's a different object. As the vm.$reused would not have been set?

If there is only 1 item in the collection, don't bother checking for other elements. `nextEl` does not exists and causes an exception. I assume this would not affect a change in the model where a new collection also has a size of one, but it's a different object. As the `vm.$reused` would not have been set?
@yyx990803
Copy link
Member

Can you provide a fiddle where the error is thrown before the fix? There is a invisible comment node at the end no matter what length the collection has, and nextEl will point to that in the case of length = 1.

@wprater
Copy link
Author

wprater commented Jun 23, 2014

ahh, that's true. However, the dom has been manipulated, but a third party carousel. so we cannot count on the comment to be there any longer.

On Jun 23, 2014, at 2:02 PM, Evan You notifications@github.com wrote:

Can you provide a fiddle where the error is thrown before the fix? There is a invisible comment node at the end no matter what length the collection has, and nextEl will point to that in the case of length = 1.


Reply to this email directly or view it on GitHub.

@yyx990803
Copy link
Member

The comment node is essential for v-repeat to work properly. It is not recommended to modify DOM that is already being managed by Vue.

@yyx990803 yyx990803 closed this Jun 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants