|
49 | 49 | }; |
50 | 50 |
|
51 | 51 | var SubsetMapping = function SubsetMapping(a, b) { |
52 | | - this.old = a; |
53 | | - this.new = b; |
| 52 | + this.oldValue = a; |
| 53 | + this.newValue = b; |
54 | 54 | }; |
55 | 55 |
|
56 | 56 | SubsetMapping.prototype = { |
57 | 57 | contains: function contains(subset) { |
58 | 58 | if (subset.length < this.length) { |
59 | | - return subset.new >= this.new && subset.new < this.new + this.length; |
| 59 | + return subset.newValue >= this.newValue && subset.newValue < this.newValue + this.length; |
60 | 60 | } |
61 | 61 | return false; |
62 | 62 | }, |
63 | 63 | toString: function toString() { |
64 | | - return this.length + " element subset, first mapping: old " + this.old + " → new " + this.new; |
| 64 | + return this.length + " element subset, first mapping: old " + this.oldValue + " → new " + this.newValue; |
65 | 65 | } |
66 | 66 | }; |
67 | 67 |
|
|
70 | 70 | if (el.nodeName !== '#text' && el.nodeName !== '#comment') { |
71 | 71 | output.push(el.nodeName); |
72 | 72 | if (el.attributes) { |
73 | | - if (el.attributes.class) { |
74 | | - output.push(el.nodeName + '.' + el.attributes.class.replace(/ /g, '.')); |
| 73 | + if (el.attributes['class']) { |
| 74 | + output.push(el.nodeName + '.' + el.attributes['class'].replace(/ /g, '.')); |
75 | 75 | } |
76 | 76 | if (el.attributes.id) { |
77 | 77 | output.push(el.nodeName + '#' + el.attributes.id); |
|
214 | 214 | return true; |
215 | 215 | } |
216 | 216 | } |
217 | | - if (e1.attributes.class && e1.attributes.class === e2.attributes.class) { |
218 | | - var classDescriptor = e1.nodeName + '.' + e1.attributes.class.replace(/ /g, '.'); |
| 217 | + if (e1.attributes['class'] && e1.attributes['class'] === e2.attributes['class']) { |
| 218 | + var classDescriptor = e1.nodeName + '.' + e1.attributes['class'].replace(/ /g, '.'); |
219 | 219 | if (classDescriptor in uniqueDescriptors) { |
220 | 220 | return true; |
221 | 221 | } |
|
353 | 353 |
|
354 | 354 | // give elements from the same subset the same group number |
355 | 355 | stable.forEach(function(subset) { |
356 | | - var i, endOld = subset.old + subset.length, |
357 | | - endNew = subset.new + subset.length; |
358 | | - for (i = subset.old; i < endOld; i += 1) { |
| 356 | + var i, endOld = subset.oldValue + subset.length, |
| 357 | + endNew = subset.newValue + subset.length; |
| 358 | + for (i = subset.oldValue; i < endOld; i += 1) { |
359 | 359 | gaps1[i] = group; |
360 | 360 | } |
361 | | - for (i = subset.new; i < endNew; i += 1) { |
| 361 | + for (i = subset.newValue; i < endNew; i += 1) { |
362 | 362 | gaps2[i] = group; |
363 | 363 | } |
364 | 364 | group += 1; |
|
385 | 385 | return arguments[1]; |
386 | 386 | }, |
387 | 387 | markBoth = function(i) { |
388 | | - marked1[subset.old + i] = true; |
389 | | - marked2[subset.new + i] = true; |
| 388 | + marked1[subset.oldValue + i] = true; |
| 389 | + marked2[subset.newValue + i] = true; |
390 | 390 | }; |
391 | 391 |
|
392 | 392 | while (subset) { |
|
875 | 875 | } |
876 | 876 | // group relocation |
877 | 877 | group = subtrees[gaps1[index2]]; |
878 | | - toGroup = Math.min(group.new, (t1.childNodes.length - group.length)); |
879 | | - if (toGroup !== group.old) { |
| 878 | + toGroup = Math.min(group.newValue, (t1.childNodes.length - group.length)); |
| 879 | + if (toGroup !== group.oldValue) { |
880 | 880 | // Check whether destination nodes are different than originating ones. |
881 | 881 | destinationDifferent = false; |
882 | 882 | for (j = 0; j < group.length; j += 1) { |
883 | | - if (!roughlyEqual(t1.childNodes[toGroup + j], t1.childNodes[group.old + j], [], false, true)) { |
| 883 | + if (!roughlyEqual(t1.childNodes[toGroup + j], t1.childNodes[group.oldValue + j], [], false, true)) { |
884 | 884 | destinationDifferent = true; |
885 | 885 | } |
886 | 886 | } |
887 | 887 | if (destinationDifferent) { |
888 | 888 | return [new Diff({ |
889 | 889 | action: 'relocateGroup', |
890 | 890 | groupLength: group.length, |
891 | | - from: group.old, |
| 891 | + from: group.oldValue, |
892 | 892 | to: toGroup, |
893 | 893 | route: route |
894 | 894 | })]; |
|
0 commit comments