fix(版本对比): 版本对比算法处理加条件
--bug=1009791--user=郭雨琦 【性能测试】版本对比,一样的地方也标注了
This commit is contained in:
parent
a63f09aaa0
commit
643718657f
|
@ -210,7 +210,7 @@ function sameDetail(oldVnode,newVnode,sameNode){
|
||||||
if(isDef(oldVnode.children)&&isDef(newVnode.children)){
|
if(isDef(oldVnode.children)&&isDef(newVnode.children)){
|
||||||
sameChildren(oldVnode.children,newVnode.children,sameNode)
|
sameChildren(oldVnode.children,newVnode.children,sameNode)
|
||||||
}
|
}
|
||||||
//剩最后的子节点的时候,分类型做判断
|
//剩最后的子节点的时候,分类型做判断,如果最后的子节点有一个不相同,sameNode就置空,
|
||||||
if(isUndef(oldVnode.child)&&isUndef(newVnode.child)&&isUndef(oldVnode.children)&&isUndef(newVnode.children)){
|
if(isUndef(oldVnode.child)&&isUndef(newVnode.child)&&isUndef(oldVnode.children)&&isUndef(newVnode.children)){
|
||||||
if(isDef(oldVnode.text)&&isDef(newVnode.text)){
|
if(isDef(oldVnode.text)&&isDef(newVnode.text)){
|
||||||
if(oldVnode.text===newVnode.text){
|
if(oldVnode.text===newVnode.text){
|
||||||
|
@ -233,6 +233,12 @@ function sameDetail(oldVnode,newVnode,sameNode){
|
||||||
}else{
|
}else{
|
||||||
sameNode.nodeArray = [];
|
sameNode.nodeArray = [];
|
||||||
}
|
}
|
||||||
|
}else if(oldVnode.tag==='textarea'&&newVnode.tag==='textarea'){
|
||||||
|
if(oldVnode.elm.value===newVnode.elm.value){
|
||||||
|
sameNode.nodeArray.push(newVnode.elm);
|
||||||
|
}else {
|
||||||
|
sameNode.nodeArray = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -288,7 +294,7 @@ function diffDetail(oldVnode,newVnode,diffNode){
|
||||||
diffNode.nodeArray.push(newVnode.elm);
|
diffNode.nodeArray.push(newVnode.elm);
|
||||||
}
|
}
|
||||||
}else if(isDef(oldVnode.tag)&&isDef(newVnode.tag)){
|
}else if(isDef(oldVnode.tag)&&isDef(newVnode.tag)){
|
||||||
if((oldVnode.tag==='input'&&newVnode.tag==='input')||(oldVnode.tag==='textarea'&&newVnode.tag==='textarea')){
|
if(oldVnode.tag==='input'&&newVnode.tag==='input'){
|
||||||
if(oldVnode.elm.value!==newVnode.elm.value){
|
if(oldVnode.elm.value!==newVnode.elm.value){
|
||||||
diffNode.oldNodeArray.push(oldVnode.elm);
|
diffNode.oldNodeArray.push(oldVnode.elm);
|
||||||
diffNode.nodeArray.push(newVnode.elm);
|
diffNode.nodeArray.push(newVnode.elm);
|
||||||
|
@ -300,6 +306,11 @@ function diffDetail(oldVnode,newVnode,diffNode){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else if(oldVnode.tag==='textarea'&&newVnode.tag==='textarea'){
|
||||||
|
if(oldVnode.elm.value!==newVnode.elm.value){
|
||||||
|
diffNode.oldNodeArray.push(oldVnode.elm);
|
||||||
|
diffNode.nodeArray.push(newVnode.elm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue