Enforce symbols for element attributes.
This comes with a little bit of memory overhead but this should be minor in most cases.
This commit is contained in:
1 parent
f4b9bbd4ac
commit
723a273e4f
5 files changed
+7
-7
No files matched your search
@@ -41,7 +41,7 @@ module Oga
|
||||
# @return [String]
|
||||
#
|
||||
def attribute(name)
|
||||
return attributes[name]
|
||||
return attributes[name.to_sym]
|
||||
end
|
||||
|
||||
alias_method :attr, :attribute
|
||||
|
||||
@@ -137,10 +137,10 @@ rule
|
||||
|
||||
attribute
|
||||
# foo
|
||||
: T_ATTR { {val[0] => nil} }
|
||||
: T_ATTR { {val[0].to_sym => nil} }
|
||||
|
||||
# foo="bar"
|
||||
| T_ATTR T_STRING { {val[0] => val[1]} }
|
||||
| T_ATTR T_STRING { {val[0].to_sym => val[1]} }
|
||||
;
|
||||
|
||||
# XML declarations
|
||||
|
||||
Reference in new issue
Block a user