Skip to content

Conversation

@gebilaoxiong
Copy link
Member

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@gebilaoxiong
Copy link
Member Author

gebilaoxiong commented May 14, 2017

Well :

Although elmToMove.elm and newStartVnode.elm are the same thing

But :

When the element index of the old list changes

We operate the old list:

Such as : https://github.com/vuejs/vue/blob/dev/src/core/vdom/patch.js#L389

else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  // ...
  canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm))
  // ...
}

And : https://github.com/vuejs/vue/blob/dev/src/core/vdom/patch.js#L394

else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  // ...
  canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm)
  // ...
}

I think updateChildren is talking about:

Operation the old list, let it become to the new one

So I think there should be use elmToMove.elm, It can make the code easier to understand

@yyx990803 yyx990803 merged commit 34bc14e into vuejs:dev May 16, 2017
@gebilaoxiong gebilaoxiong deleted the improve-patch branch May 16, 2017 01:29
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

Successfully merging this pull request may close these issues.

2 participants