Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dom/element/attributes: some fixes for name polyfills
- Loading branch information
Showing
2 changed files
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
module Browser; module DOM; class Element < Node | ||
|
||
class Attributes | ||
@@normalize = {} | ||
@@normalize = `{}` | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
meh
Author
Member
|
||
|
||
if Browser.supports? 'Element.className' | ||
@@normalize[:class] = :className | ||
`#@@normalize['class'] = 'className'` | ||
end | ||
|
||
if Browser.supports? 'Element.htmlFor' | ||
@@normalize[:for] = :htmlFor | ||
`#@@normalize['for'] = 'htmlFor'` | ||
end | ||
|
||
attr_reader :namespace | ||
|
@@ -20,7 +20,7 @@ def initialize(element, options) | |
end | ||
|
||
def [](name, options = {}) | ||
name = @@normalize[name] || name | ||
name = `#@@normalize[name] || name` | ||
|
||
if namespace = options[:namespace] || @namespace | ||
`#@native.getAttributeNS(#{namespace.to_s}, #{name.to_s}) || nil` | ||
|
@@ -30,7 +30,7 @@ def [](name, options = {}) | |
end | ||
|
||
def []=(name, value, options = {}) | ||
name = @@normalize[name] || name | ||
name = `#@@normalize[name] || name` | ||
|
||
if namespace = options[:namespace] || @namespace | ||
`#@native.setAttributeNS(#{namespace.to_s}, #{name.to_s}, #{value})` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Is this just an optimization? Why didn't the ruby hash work?