nurugger07 / calliope

An elixir haml parser
Apache License 2.0
198 stars 36 forks source link

Attributes with names ending with "id" get interpreted as the "id" attribute #69

Open benkuhn opened 8 years ago

benkuhn commented 8 years ago

Steps to repro (on version 0.3.0, first and fourth lines are the bug):

iex(1)> Calliope.render(".foo{attr-id: \"bar\"}")
"<div id=\"bar\" class=\"foo\" attr-></div>"
iex(2)> Calliope.render(".foo{attr-id-bar: \"bar\"}")
"<div class=\"foo\" attr-id-bar=\"bar\"></div>"
iex(3)> Calliope.render(".foo{id-bar: \"bar\"}")
"<div class=\"foo\" id-bar=\"bar\"></div>"
iex(4)> Calliope.render(".foo(attr-id= \"bar\")")
"<div id=\"bar\" class=\"foo\" attr-></div>"

I'd expect the output of the first/fourth line to be "<div class=\"foo\" attr-id=\"bar\"></div>" similar to lines 2/3. I ran across this while trying to create an element with a data-form-id attribute, which I couldn't find a way to do.

papergliff commented 8 years ago

@benkuhn on version 0.4.1 there is not this issue anymore)