Merge pull request #827 from w1150n/master

Memoize native calls for tag_name and attributes
This commit is contained in:
Jonas Nicklas 2012-09-19 00:15:14 -07:00
commit 2c57735b60
1 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,8 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
end
def [](name)
native.attribute(name.to_s)
@attrs = {}
@attrs[name] ||= native.attribute(name.to_s)
rescue Selenium::WebDriver::Error::WebDriverError
nil
end
@ -50,7 +51,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
end
def tag_name
native.tag_name.downcase
@tag_name ||= native.tag_name.downcase
end
def visible?