@@ -70,13 +70,13 @@ Deno.test('handleProcInst', () => {
70
70
71
71
Deno . test ( 'handleProcInstEnding' , ( ) => {
72
72
const cx = new XMLParseContext ( ) ;
73
- // processing_instruction & GENERAL_STUFF
73
+ // processing_instruction & BEFORE_DOCUMENT
74
74
cx . state = 'PROC_INST_ENDING' ;
75
75
cx . appendMemento ( 'test' ) ;
76
76
const [ [ event , procInst ] ] = handler . handleProcInstEnding ( cx , '>' ) ;
77
77
assertEquals ( event , 'processing_instruction' ) ;
78
78
assertEquals ( procInst , 'test' ) ;
79
- assertEquals ( cx . state , 'GENERAL_STUFF ' ) ;
79
+ assertEquals ( cx . state , 'BEFORE_DOCUMENT ' ) ;
80
80
// stay
81
81
cx . state = 'PROC_INST_ENDING' ;
82
82
cx . appendMemento ( 'test' ) ;
@@ -102,13 +102,13 @@ Deno.test('handleSgmlDecl', () => {
102
102
cx . appendMemento ( 'DOCTYP' ) ;
103
103
handler . handleSgmlDecl ( cx , 'E' ) ;
104
104
assertEquals ( cx . state , 'DOCTYPE' ) ;
105
- // sgml_declaration & GENERAL_STUFF
105
+ // sgml_declaration & BEFORE_DOCUMENT
106
106
cx . state = 'SGML_DECL' ;
107
107
cx . appendMemento ( 'test' ) ;
108
108
const [ [ event , sgml ] ] = handler . handleSgmlDecl ( cx , '>' ) ;
109
109
assertEquals ( event , 'sgml_declaration' ) ;
110
110
assertEquals ( sgml , 'test' ) ;
111
- assertEquals ( cx . state , 'GENERAL_STUFF ' ) ;
111
+ assertEquals ( cx . state , 'BEFORE_DOCUMENT ' ) ;
112
112
assertEquals ( cx . memento , '' ) ;
113
113
// Error
114
114
cx . state = 'SGML_DECL' ;
@@ -204,19 +204,20 @@ Deno.test('handleCommentEnding2', () => {
204
204
205
205
Deno . test ( 'handleDoctype' , ( ) => {
206
206
const cx = new XMLParseContext ( ) ;
207
- // doctype & GENERAL_STUFF
207
+ // doctype & BEFORE_DOCUMENT
208
208
cx . state = 'DOCTYPE' ;
209
209
cx . appendMemento ( 'tes' ) ;
210
210
handler . handleDoctype ( cx , 't' ) ;
211
211
const [ [ event , doctype ] ] = handler . handleDoctype ( cx , '>' ) ;
212
212
assertEquals ( event , 'doctype' ) ;
213
213
assertEquals ( doctype , 'test' ) ;
214
- assertEquals ( cx . state , 'GENERAL_STUFF ' ) ;
214
+ assertEquals ( cx . state , 'BEFORE_DOCUMENT ' ) ;
215
215
} ) ;
216
216
217
217
Deno . test ( 'handleStartTag' , ( ) => {
218
218
const cx = new XMLParseContext ( ) ;
219
219
// start_element & GENERAL_STUFF
220
+ cx . newElement ( 'root' ) ;
220
221
cx . state = 'START_TAG' ;
221
222
cx . appendMemento ( 'a' ) ;
222
223
const [ [ event , element ] ] = handler . handleStartTag ( cx , '>' ) ;
@@ -239,6 +240,7 @@ Deno.test('handleStartTag', () => {
239
240
Deno . test ( 'handleStartTagStuff' , ( ) => {
240
241
const cx = new XMLParseContext ( ) ;
241
242
// start_element & GENERAL_STUFF
243
+ cx . newElement ( 'root' ) ;
242
244
cx . state = 'START_TAG_STUFF' ;
243
245
cx . newElement ( 'a' ) ;
244
246
const [ [ event , element ] ] = handler . handleStartTagStuff ( cx , '>' ) ;
@@ -262,6 +264,7 @@ Deno.test('handleStartTagStuff', () => {
262
264
Deno . test ( 'handleEmptyElementTag' , ( ) => {
263
265
const cx = new XMLParseContext ( ) ;
264
266
// start_element & end_element & GENERAL_STUFF
267
+ cx . newElement ( 'root' ) ;
265
268
cx . state = 'EMPTY_ELEMENT_TAG' ;
266
269
cx . newElement ( 'test' ) ;
267
270
const [ [ event0 , element0 ] , [ event1 , element1 ] ] = handler . handleEmptyElementTag ( cx , '>' ) ;
@@ -322,6 +325,7 @@ Deno.test('handleAttributeEqual', () => {
322
325
Deno . test ( 'handleAttributeValueStart' , ( ) => {
323
326
const cx = new XMLParseContext ( ) ;
324
327
// ATTRIBUTE_VALUE_END
328
+ cx . newElement ( 'root' ) ;
325
329
cx . state = 'ATTRIBUTE_VALUE_START' ;
326
330
cx . newElement ( 'a' ) ;
327
331
cx . peekElement ( ) ! . newAttribute ( 'b' ) ;
@@ -343,6 +347,7 @@ Deno.test('handleAttributeValueEnd', () => {
343
347
handler . handleAttributeValueEnd ( cx , '/' ) ;
344
348
assertEquals ( cx . state , 'EMPTY_ELEMENT_TAG' ) ;
345
349
// start_element & GENERAL_STUFF
350
+ cx . newElement ( 'root' ) ;
346
351
cx . state = 'ATTRIBUTE_VALUE_END' ;
347
352
cx . newElement ( 'a' ) ;
348
353
const [ [ event , element ] ] = handler . handleAttributeValueEnd ( cx , '>' ) ;
0 commit comments