问题
If I create an XML element in HAML:
%tag{:b => "b", :a => "a"}
I get this output:
<tag a="a" b="b"/>
Is it possible to keep the ordering of the attributes in HAML?
I need this for a client-side code to display values in certain order and don't want to pass extra information on the client just to maintain ordering.
回答1:
It's not possible with HAML because it's a hash.
来源:https://stackoverflow.com/questions/7766240/preserve-attribute-ordering-in-haml