taoqf / node-html-parser

A very fast HTML parser, generating a simplified DOM, with basic element query support.
MIT License
1.12k stars 112 forks source link

get an error when parse vue html #243

Closed samoyee closed 1 year ago

samoyee commented 1 year ago

parse code

<div @click.stop>xxx</div>

it will become two attrs @click, .stop

I try to resolve the problem, change the code in line:693 ./src/nodes/html.ts

const re = /([a-zA-Z()[\]#@$.?:][a-zA-Z0-9-_:()[\]#]*)(?:\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+))?/g;
const re = /([a-zA-Z()[\]#@$.?:][a-zA-Z0-9-_\.:()[\]#]*)(?:\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+))?/g;

add \.

rschristian commented 1 year ago

Vue and HTML are entirely separate things, so this seems to be correct behavior.