@@ -20,7 +20,7 @@ func TestSingleTextChange(t *testing.T) {
20
20
root : "<div>Hello</div>" ,
21
21
proposed : "<div>World</div>" ,
22
22
patches : []Patch {
23
- {Anchor : "_l0010 " , Action : Replace , HTML : `<div _l0010 ="">World</div>` },
23
+ {Anchor : "_l_0_1_0 " , Action : Replace , HTML : `<div _l_0_1_0 ="">World</div>` },
24
24
},
25
25
}, t )
26
26
}
@@ -30,8 +30,8 @@ func TestMultipleTextChange(t *testing.T) {
30
30
root : `<div>Hello</div><div>World</div>` ,
31
31
proposed : `<div>World</div><div>Hello</div>` ,
32
32
patches : []Patch {
33
- {Anchor : "_l0010 " , Action : Replace , HTML : `<div _l0010 ="">World</div>` },
34
- {Anchor : "_l0011 " , Action : Replace , HTML : `<div _l0011 ="">Hello</div>` },
33
+ {Anchor : "_l_0_1_0 " , Action : Replace , HTML : `<div _l_0_1_0 ="">World</div>` },
34
+ {Anchor : "_l_0_1_1 " , Action : Replace , HTML : `<div _l_0_1_1 ="">Hello</div>` },
35
35
},
36
36
}, t )
37
37
}
@@ -41,15 +41,15 @@ func TestNodeAppend(t *testing.T) {
41
41
root : `<div>World</div>` ,
42
42
proposed : `<div>Hello</div><div>World</div>` ,
43
43
patches : []Patch {
44
- {Anchor : "_l0010 " , Action : Replace , HTML : `<div _l0010 ="">Hello</div>` },
45
- {Anchor : "_l001 " , Action : Append , HTML : `<div _l0011 ="">World</div>` },
44
+ {Anchor : "_l_0_1_0 " , Action : Replace , HTML : `<div _l_0_1_0 ="">Hello</div>` },
45
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<div _l_0_1_1 ="">World</div>` },
46
46
},
47
47
}, t )
48
48
runDiffTest (diffTest {
49
49
root : `<div>Hello</div>` ,
50
50
proposed : `<div>Hello</div><div>World</div>` ,
51
51
patches : []Patch {
52
- {Anchor : "_l001 " , Action : Append , HTML : `<div _l0011 ="">World</div>` },
52
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<div _l_0_1_1 ="">World</div>` },
53
53
},
54
54
}, t )
55
55
}
@@ -59,15 +59,15 @@ func TestNodeDeletion(t *testing.T) {
59
59
root : `<div>Hello</div><div>World</div>` ,
60
60
proposed : `<div>World</div>` ,
61
61
patches : []Patch {
62
- {Anchor : "_l0010 " , Action : Replace , HTML : `<div _l0010 ="">World</div>` },
63
- {Anchor : "_l0011 " , Action : Replace , HTML : "" },
62
+ {Anchor : "_l_0_1_0 " , Action : Replace , HTML : `<div _l_0_1_0 ="">World</div>` },
63
+ {Anchor : "_l_0_1_1 " , Action : Replace , HTML : "" },
64
64
},
65
65
}, t )
66
66
runDiffTest (diffTest {
67
67
root : `<div>Hello</div><div>World</div>` ,
68
68
proposed : `<div>Hello</div>` ,
69
69
patches : []Patch {
70
- {Anchor : "_l0011 " , Action : Replace , HTML : "" },
70
+ {Anchor : "_l_0_1_1 " , Action : Replace , HTML : "" },
71
71
},
72
72
}, t )
73
73
}
@@ -77,7 +77,7 @@ func TestAttributeValueChange(t *testing.T) {
77
77
root : `<div place="World">Hello</div>` ,
78
78
proposed : `<div place="Change">Hello</div>` ,
79
79
patches : []Patch {
80
- {Anchor : "_l0010 " , Action : Replace , HTML : `<div place="Change" _l0010 ="">Hello</div>` },
80
+ {Anchor : "_l_0_1_0 " , Action : Replace , HTML : `<div place="Change" _l_0_1_0 ="">Hello</div>` },
81
81
},
82
82
}, t )
83
83
}
@@ -87,8 +87,8 @@ func TestMultipleAttributeValueChange(t *testing.T) {
87
87
root : `<div place="World">World</div><div place="Hello">Hello</div>` ,
88
88
proposed : `<div place="Hello">Hello</div><div place="World">World</div>` ,
89
89
patches : []Patch {
90
- {Anchor : "_l0010 " , Action : Replace , HTML : `<div place="Hello" _l0010 ="">Hello</div>` },
91
- {Anchor : "_l0011 " , Action : Replace , HTML : `<div place="World" _l0011 ="">World</div>` },
90
+ {Anchor : "_l_0_1_0 " , Action : Replace , HTML : `<div place="Hello" _l_0_1_0 ="">Hello</div>` },
91
+ {Anchor : "_l_0_1_1 " , Action : Replace , HTML : `<div place="World" _l_0_1_1 ="">World</div>` },
92
92
},
93
93
}, t )
94
94
}
@@ -99,9 +99,9 @@ func TestNestedAppend(t *testing.T) {
99
99
root : `<form><input type="text"/><input type="submit"/></form>` ,
100
100
proposed : `<form><div>Extra</div><input type="text"/><input type="submit"/></form>` ,
101
101
patches : []Patch {
102
- {Anchor : "_l00100 " , Action : Replace , HTML : `<div _l00100 ="">Extra</div>` },
103
- {Anchor : "_l00101 " , Action : Replace , HTML : `<input type="text" _l00101 =""/>` },
104
- {Anchor : "_l0010 " , Action : Append , HTML : `<input type="submit" _l00102 =""/>` },
102
+ {Anchor : "_l_0_1_0_0 " , Action : Replace , HTML : `<div _l_0_1_0_0 ="">Extra</div>` },
103
+ {Anchor : "_l_0_1_0_1 " , Action : Replace , HTML : `<input type="text" _l_0_1_0_1 =""/>` },
104
+ {Anchor : "_l_0_1_0 " , Action : Append , HTML : `<input type="submit" _l_0_1_0_2 =""/>` },
105
105
},
106
106
},
107
107
}
@@ -115,8 +115,8 @@ func TestDoc(t *testing.T) {
115
115
root : "<!doctype><html><head><title>1</title></head><body><div>1</div></body></html>" ,
116
116
proposed : "<!doctype><html><head><title>2</title></head><body><div>2</div></body></html>" ,
117
117
patches : []Patch {
118
- {Anchor : "_l0100 " , Action : Replace , HTML : `<title _l0100 ="">2</title>` },
119
- {Anchor : "_l0110 " , Action : Replace , HTML : `<div _l0110 ="">2</div>` },
118
+ {Anchor : "_l_1_0_0 " , Action : Replace , HTML : `<title _l_1_0_0 ="">2</title>` },
119
+ {Anchor : "_l_1_1_0 " , Action : Replace , HTML : `<div _l_1_1_0 ="">2</div>` },
120
120
},
121
121
}, t )
122
122
}
@@ -166,11 +166,11 @@ func TestEarlyChildDeletion(t *testing.T) {
166
166
<input type="submit"/>
167
167
</form>` ,
168
168
patches : []Patch {
169
- {Anchor : "_l00100 " , Action : Replace , HTML : `<input type="text" _l00100 =""/>` },
170
- {Anchor : "_l00101 " , Action : Replace , HTML : `<input type="submit" _l00101 =""/>` },
171
- {Anchor : "_l00102 " , Action : Replace , HTML : `` },
172
- {Anchor : "_l00103 " , Action : Replace , HTML : `` },
173
- {Anchor : "_l00104 " , Action : Replace , HTML : `` },
169
+ {Anchor : "_l_0_1_0_0 " , Action : Replace , HTML : `<input type="text" _l_0_1_0_0 =""/>` },
170
+ {Anchor : "_l_0_1_0_1 " , Action : Replace , HTML : `<input type="submit" _l_0_1_0_1 =""/>` },
171
+ {Anchor : "_l_0_1_0_2 " , Action : Replace , HTML : `` },
172
+ {Anchor : "_l_0_1_0_3 " , Action : Replace , HTML : `` },
173
+ {Anchor : "_l_0_1_0_4 " , Action : Replace , HTML : `` },
174
174
},
175
175
},
176
176
}
@@ -194,9 +194,9 @@ func TestInsignificantWhitespace(t *testing.T) {
194
194
<input type="submit"/>
195
195
</form>` ,
196
196
patches : []Patch {
197
- {Anchor : "_l00100 " , Action : Replace , HTML : `<div _l00100 ="">Extra</div>` },
198
- {Anchor : "_l00101 " , Action : Replace , HTML : `<input type="text" _l00101 =""/>` },
199
- {Anchor : "_l0010 " , Action : Append , HTML : `<input type="submit" _l00102 =""/>` },
197
+ {Anchor : "_l_0_1_0_0 " , Action : Replace , HTML : `<div _l_0_1_0_0 ="">Extra</div>` },
198
+ {Anchor : "_l_0_1_0_1 " , Action : Replace , HTML : `<input type="text" _l_0_1_0_1 =""/>` },
199
+ {Anchor : "_l_0_1_0 " , Action : Append , HTML : `<input type="submit" _l_0_1_0_2 =""/>` },
200
200
},
201
201
},
202
202
}
@@ -211,7 +211,7 @@ func TestLiveUpdate(t *testing.T) {
211
211
root : `<div live-update="append"><div>Hello</div></div>` ,
212
212
proposed : `<div live-update="append"><div>World</div></div>` ,
213
213
patches : []Patch {
214
- {Anchor : "_l0010 " , Action : Append , HTML : `<div _l00100 ="">World</div>` },
214
+ {Anchor : "_l_0_1_0 " , Action : Append , HTML : `<div _l_0_1_0_0 ="">World</div>` },
215
215
},
216
216
},
217
217
{
@@ -224,28 +224,28 @@ func TestLiveUpdate(t *testing.T) {
224
224
<div>World</div>
225
225
</div>` ,
226
226
patches : []Patch {
227
- {Anchor : "_l0010 " , Action : Append , HTML : `<div _l00100 ="">World</div>` },
227
+ {Anchor : "_l_0_1_0 " , Action : Append , HTML : `<div _l_0_1_0_0 ="">World</div>` },
228
228
},
229
229
},
230
230
{
231
231
root : `<div live-update="prepend"><div>Hello</div></div>` ,
232
232
proposed : `<div live-update="prepend"><div>World</div></div>` ,
233
233
patches : []Patch {
234
- {Anchor : "_l0010 " , Action : Prepend , HTML : `<div _l00100 ="">World</div>` },
234
+ {Anchor : "_l_0_1_0 " , Action : Prepend , HTML : `<div _l_0_1_0_0 ="">World</div>` },
235
235
},
236
236
},
237
237
{
238
238
root : `<div live-update="replace"><div>Hello</div></div>` ,
239
239
proposed : `<div live-update="replace"><div>World</div></div>` ,
240
240
patches : []Patch {
241
- {Anchor : "_l0010 " , Action : Replace , HTML : `<div _l00100 ="">World</div>` },
241
+ {Anchor : "_l_0_1_0 " , Action : Replace , HTML : `<div _l_0_1_0_0 ="">World</div>` },
242
242
},
243
243
},
244
244
{
245
245
root : `<div live-update="ignore"><div>Hello</div></div>` ,
246
246
proposed : `<div live-update="ignore"><div>World</div></div>` ,
247
247
patches : []Patch {
248
- {Anchor : "_l0010 " , Action : Noop , HTML : `<div _l00100 ="">World</div>` },
248
+ {Anchor : "_l_0_1_0 " , Action : Noop , HTML : `<div _l_0_1_0_0 ="">World</div>` },
249
249
},
250
250
},
251
251
}
@@ -276,16 +276,16 @@ func TestIssue6(t *testing.T) {
276
276
<script src="./live.js"></script>
277
277
` ,
278
278
patches : []Patch {
279
- {Anchor : "_l0011 " , Action : Replace , HTML : `<pre _l0011 ="">1</pre>` },
280
- {Anchor : "_l001 " , Action : Append , HTML : `<script src="./live.js" _l0012 =""></script>` },
279
+ {Anchor : "_l_0_1_1 " , Action : Replace , HTML : `<pre _l_0_1_1 ="">1</pre>` },
280
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<script src="./live.js" _l_0_1_2 =""></script>` },
281
281
},
282
282
},
283
283
{
284
284
root : `<form><input type="text"/><input type="submit"/></form><script src="./live.js"></script>` ,
285
285
proposed : `<form><input type="text"/><input type="submit"/></form><pre>1</pre><script src="./live.js"></script>` ,
286
286
patches : []Patch {
287
- {Anchor : "_l0011 " , Action : Replace , HTML : `<pre _l0011 ="">1</pre>` },
288
- {Anchor : "_l001 " , Action : Append , HTML : `<script src="./live.js" _l0012 =""></script>` },
287
+ {Anchor : "_l_0_1_1 " , Action : Replace , HTML : `<pre _l_0_1_1 ="">1</pre>` },
288
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<script src="./live.js" _l_0_1_2 =""></script>` },
289
289
},
290
290
},
291
291
{
@@ -311,16 +311,16 @@ func TestIssue6(t *testing.T) {
311
311
<script src="./live.js"></script>
312
312
` ,
313
313
patches : []Patch {
314
- {Anchor : "_l0012 " , Action : Replace , HTML : `<pre _l0012 ="">2</pre>` },
315
- {Anchor : "_l001 " , Action : Append , HTML : `<script src="./live.js" _l0013 =""></script>` },
314
+ {Anchor : "_l_0_1_2 " , Action : Replace , HTML : `<pre _l_0_1_2 ="">2</pre>` },
315
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<script src="./live.js" _l_0_1_3 =""></script>` },
316
316
},
317
317
},
318
318
{
319
319
root : `<form><input type="text"/><input type="submit"/></form><pre>1</pre><script src="./live.js"></script>` ,
320
320
proposed : `<form><input type="text"/><input type="submit"/></form><pre>1</pre><pre>2</pre><script src="./live.js"></script>` ,
321
321
patches : []Patch {
322
- {Anchor : "_l0012 " , Action : Replace , HTML : `<pre _l0012 ="">2</pre>` },
323
- {Anchor : "_l001 " , Action : Append , HTML : `<script src="./live.js" _l0013 =""></script>` },
322
+ {Anchor : "_l_0_1_2 " , Action : Replace , HTML : `<pre _l_0_1_2 ="">2</pre>` },
323
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<script src="./live.js" _l_0_1_3 =""></script>` },
324
324
},
325
325
},
326
326
{
@@ -348,16 +348,16 @@ func TestIssue6(t *testing.T) {
348
348
<script src="./live.js"></script>
349
349
` ,
350
350
patches : []Patch {
351
- {Anchor : "_l0013 " , Action : Replace , HTML : `<pre _l0013 ="">3</pre>` },
352
- {Anchor : "_l001 " , Action : Append , HTML : `<script src="./live.js" _l0014 =""></script>` },
351
+ {Anchor : "_l_0_1_3 " , Action : Replace , HTML : `<pre _l_0_1_3 ="">3</pre>` },
352
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<script src="./live.js" _l_0_1_4 =""></script>` },
353
353
},
354
354
},
355
355
{
356
356
root : `<form><input type="text"/><input type="submit"/></form><pre>1</pre><pre>2</pre><script src="./live.js"></script>` ,
357
357
proposed : `<form><input type="text"/><input type="submit"/></form><pre>1</pre><pre>2</pre><pre>3</pre><script src="./live.js"></script>` ,
358
358
patches : []Patch {
359
- {Anchor : "_l0013 " , Action : Replace , HTML : `<pre _l0013 ="">3</pre>` },
360
- {Anchor : "_l001 " , Action : Append , HTML : `<script src="./live.js" _l0014 =""></script>` },
359
+ {Anchor : "_l_0_1_3 " , Action : Replace , HTML : `<pre _l_0_1_3 ="">3</pre>` },
360
+ {Anchor : "_l_0_1 " , Action : Append , HTML : `<script src="./live.js" _l_0_1_4 =""></script>` },
361
361
},
362
362
},
363
363
}
@@ -385,10 +385,10 @@ func TestListReplace(t *testing.T) {
385
385
</table>
386
386
` ,
387
387
patches : []Patch {
388
- {Anchor : "_l0010000 " , Action : Replace , HTML : `<td colspan="2" _l0010000 ="">No thingers</td>` },
389
- {Anchor : "_l0010001 " , Action : Replace , HTML : `` },
390
- {Anchor : "_l001001 " , Action : Replace , HTML : `` },
391
- {Anchor : "_l001002 " , Action : Replace , HTML : `` },
388
+ {Anchor : "_l_0_1_0_0_0_0 " , Action : Replace , HTML : `<td colspan="2" _l_0_1_0_0_0_0 ="">No thingers</td>` },
389
+ {Anchor : "_l_0_1_0_0_0_1 " , Action : Replace , HTML : `` },
390
+ {Anchor : "_l_0_1_0_0_1 " , Action : Replace , HTML : `` },
391
+ {Anchor : "_l_0_1_0_0_2 " , Action : Replace , HTML : `` },
392
392
},
393
393
}, t )
394
394
}
0 commit comments