diff --git a/lib/capybara/node/simple.rb b/lib/capybara/node/simple.rb
index 71a5fef5..a4dbe7c8 100644
--- a/lib/capybara/node/simple.rb
+++ b/lib/capybara/node/simple.rb
@@ -74,7 +74,7 @@ module Capybara
#
def value
if tag_name == 'textarea'
- native.content.sub(/\A\n/, '')
+ native.inner_html.sub(/\A\n/, '')
elsif tag_name == 'select'
if native['multiple'] == 'multiple'
native.xpath(".//option[@selected='selected']").map { |option| option[:value] || option.content }
diff --git a/lib/capybara/rack_test/form.rb b/lib/capybara/rack_test/form.rb
index 55254934..7ba585e0 100644
--- a/lib/capybara/rack_test/form.rb
+++ b/lib/capybara/rack_test/form.rb
@@ -60,7 +60,7 @@ class Capybara::RackTest::Form < Capybara::RackTest::Node
merge_param!(params, field['name'].to_s, (option['value'] || option.text).to_s) if option
end
when 'textarea'
- merge_param!(params, field['name'].to_s, field.text.to_s)
+ merge_param!(params, field['name'].to_s, field.inner_html.to_s)
end
end
merge_param!(params, button[:name], button[:value] || "") if button[:name]
diff --git a/lib/capybara/rack_test/node.rb b/lib/capybara/rack_test/node.rb
index d74f5cfb..6ec66289 100644
--- a/lib/capybara/rack_test/node.rb
+++ b/lib/capybara/rack_test/node.rb
@@ -27,7 +27,7 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
elsif input_field?
set_input(value)
elsif textarea?
- native.content = value.to_s unless self[:readonly]
+ native.inner_html = value.to_s unless self[:readonly]
end
end
diff --git a/lib/capybara/spec/session/node_spec.rb b/lib/capybara/spec/session/node_spec.rb
index c015c8e7..1d9c82de 100644
--- a/lib/capybara/spec/session/node_spec.rb
+++ b/lib/capybara/spec/session/node_spec.rb
@@ -58,10 +58,14 @@ Capybara::SpecHelper.spec "node" do
@session.find('//textarea[@id="additional_newline"]').value.should == "\nbanana"
end
- it "return any HTML content in textarea" do
+ it "return any HTML content added to textarea" do
@session.find('//textarea[1]').set("some html here")
@session.find('//textarea[1]').value.should == "some html here"
end
+
+ it "return any HTML content in textarea", :focus => true do
+ @session.find(:css, 'textarea#with-html').value.should == "contains html"
+ end
end
describe "#set" do
diff --git a/lib/capybara/spec/views/with_html.erb b/lib/capybara/spec/views/with_html.erb
index dd7a5c9b..c8acafcd 100644
--- a/lib/capybara/spec/views/with_html.erb
+++ b/lib/capybara/spec/views/with_html.erb
@@ -35,6 +35,7 @@ banana
banana
+
BackToMyself
A link came first
A link