choojs / hyperx

🏷 - tagged template string virtual dom builder
BSD 2-Clause "Simplified" License
1.01k stars 48 forks source link

Fixed issue #55 parsing void tags #56

Closed josephg closed 6 years ago

josephg commented 6 years ago

This fixes a bug where the parser doesn't realise that void elements with attributes are closed.

The problem was that the attribute parser code erroneously consumed the CLOSE element in the loop in index.js:75. This stopped the special selfClosing logic from running.

josephg commented 6 years ago

Tests pass:

$ npm run test
...
1..53
# tests 53
# pass  53

# ok

The code also seems to work correctly if we unconditionally decrement i on line 91, but its probably more correct to let the attribute handling code eat the ATTR_BREAK token.

yoshuawuyts commented 6 years ago

v2.3.1 :tada: