nurugger07 / calliope

An elixir haml parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

benkuhn opened this issue · comments

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.

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