Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use stable attribute sorting

  • Loading branch information...
commit b617985d9ace0745a6b2baa825a66476c3aa86bb 1 parent f05d047
@minad minad authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/temple/html/attribute_sorter.rb
View
3  lib/temple/html/attribute_sorter.rb
@@ -10,9 +10,10 @@ def call(exp)
end
def on_html_attrs(*attrs)
+ n = 0 # Use n to make sort stable. This is important because the merger could be executed afterwards.
[:html, :attrs, *attrs.sort_by do |attr|
raise(InvalidExpression, 'Attribute is not a html attr') if attr[0] != :html || attr[1] != :attr
- attr[2].to_s
+ [attr[2].to_s, n += 1]
end]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.