Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser Error - wrong token #32

Closed
mashihua opened this issue Aug 3, 2011 · 0 comments
Closed

Parser Error - wrong token #32

mashihua opened this issue Aug 3, 2011 · 0 comments

Comments

@mashihua
Copy link
Contributor

mashihua commented Aug 3, 2011

I find some error with following code:

var HTML5 = require('html5')
var p = new HTML5.Parser();
HTML5.enableDebug('tokenizer.token')
var str = '<!DOCTYPE html>\n' +
'<html> \n'+
'<body>\n'+
'<script>\n' +
'var a = 1;\n' +
'</script>\n' +
'<a href="#">top</a>\n'
p.parse(str);

The output is:

DEBUG: 'tokenizer.token' { type: 'Doctype',
name: 'html',
publicId: null,
systemId: null,
correct: true }
DEBUG: 'tokenizer.token' { type: 'SpaceCharacters', data: '\n' }
DEBUG: 'tokenizer.token' { type: 'StartTag', name: 'html', data: [] }
DEBUG: 'tokenizer.token' { type: 'SpaceCharacters', data: ' ' }
DEBUG: 'tokenizer.token' { type: 'SpaceCharacters', data: ' ' }
DEBUG: 'tokenizer.token' { type: 'SpaceCharacters', data: '\n' }
DEBUG: 'tokenizer.token' { type: 'StartTag', name: 'body', data: [] }
DEBUG: 'tokenizer.token' { type: 'SpaceCharacters', data: '\n' }
DEBUG: 'tokenizer.token' { type: 'Characters', data: undefined }
DEBUG: 'tokenizer.token' { type: 'StartTag', name: 'script', data: [] }
DEBUG: 'tokenizer.token' { type: 'SpaceCharacters', data: '\n' }
DEBUG: 'tokenizer.token' { type: 'Characters', data: 'var a = 1;\n' }
DEBUG: 'tokenizer.token' { type: 'Characters', data: 'var a = 1;\n' }
DEBUG: 'tokenizer.token' { type: 'EndTag', name: 'script', data: [] }
DEBUG: 'tokenizer.token' { type: 'SpaceCharacters', data: '\n' }
DEBUG: 'tokenizer.token' { type: 'StartTag',
name: 'a',
data: [ { nodeName: 'href', nodeValue: '#' } ] }
DEBUG: 'tokenizer.token' { type: 'Characters', data: 'top' }
DEBUG: 'tokenizer.token' { type: 'EndTag', name: 'a', data: [] }
DEBUG: 'tokenizer.token' { type: 'EOF', data: 'End of File' }

The token give me { type: 'Characters', data: undefined } after { type: 'StartTag', name: 'body', data: [] } which is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants