This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//green - збережені елемени | |
//red - видалені елменти | |
//blue - додані елменти | |
//orange - змінені елменти | |
var b, //before - перший фрагмент | |
a; //after - другий фрагмент | |
var bTag, //тегы before | |
aTag; //тегы after | |
var elem = [], //масив елементів з after, які збереглися у before | |
num=0, //кількість елементів у масиві elem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i=0;i<aTag.length;i++){ | |
var someTag=aTag[i].tagName===el.tagName; | |
if(someTag) | |
if(checkSrc(aTag[i], i)) | |
return last(aTag[i], i); | |
function checkSrc(element, index){ | |
if(element.src!==undefined) return tagTrue(element, index); | |
else return tagFalse(element, index); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ДО | |
function prepear(){ | |
//перевірка на рівності фрагментів | |
if(b.innerText===a.innerText){ | |
b.style.color="green"; | |
a.style.color="green"; | |
} | |
else{ | |
b.style.color="red"; | |
a.style.color="blue"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ДО | |
function position(el){ | |
//елемент, що шукається серед елментів after | |
for(var i=0;i<aTag.length;i++){ | |
if(aTag[i].tagName===el.tagName){ | |
if(aTag[i].src!==undefined){ | |
if(aTag[i].style.cssText!=="border: 4px solid green;" && el.src===aTag[i].src && mark[i]){ | |
mark[i]=false; | |
//перевірка чи поточний знайдений елемент має правильне розташування | |
if(i>cur){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ДО | |
function checkHref(beforeChilde, afterChilde, func){ | |
/*елемент з фрагменту before, елемент з фрагменту after, значення виклику функції | |
(значення пошуку однакових елементів/елементів, які потребують заміни, у фрагментах before та after)*/ | |
if(func){ | |
if(beforeChilde.href!==undefined && afterChilde.href!==undefined){ | |
if(beforeChilde.href===afterChilde.href){ | |
return true; | |
} | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ДО | |
if(numBefore!==0){ | |
//перевірка умови існування одного батька у елементів | |
if(beforeChilde.parentNode===elemBefore[numBefore-1].parentNode){ | |
//перевірка умови існування одного батька | |
if(afterChilde.parentNode===elem[num-1].parentNode){ | |
return true; | |
} | |
else | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ДО | |
var childe = node.firstChild; //елемент перший син node | |
while(childe){ | |
if (childe.tagName!==undefined){ | |
if(!task){ | |
//пошук доданих елементів | |
if(name===1){ | |
if(childe.style.color==="blue" || childe.style.cssText==="border: 4px solid blue;"){ | |
objFirst.element[objFirst.element.length]=childe; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
До | |
var beforeChilde = beforeNode.firstChild, //перший син beforeNode | |
afterChilde = afterNode; //елемент рівний afterNode | |
while(beforeChilde){ | |
if(beforeChilde.tagName!==undefined){ | |
if(beforeChilde.style.color==="green"){ | |
for(var i=0; i<afterNode.childElementCount;i++){ | |
afterChilde=afterNode.children[i];//елемент син afterNode | |
if(afterChilde.style.color==="green"){ | |
if(afterChilde.tagName===beforeChilde.tagName){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>TEST</title> | |
</head> | |
<body> | |
<h1><span>3</span> <span>2</span></h1> | |
<div> | |
<span>1</span> <span>2</span> <span>2</span> <br> | |
<span>2</span> <span>3</span> <span>2</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body, table, td, th, span, div{ | |
padding: 0px; | |
margin: 0px; | |
} | |
body{ | |
background: #dedede; | |
} | |
table { | |
border-collapse: collapse; |
OlderNewer