1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use Element.update('id', 'html') instead of uid=501(sam) gid=501(sam) groups=501(sam), 81(appserveradm), 79(appserverusr), 80(admin).innerHTML = 'html' in JavaScriptGenerator#replace_html so that script tags are evaluated

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3086 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Sam Stephenson 2005-11-18 18:03:45 +00:00
parent 62fe5bbfb1
commit b3c65bc849
3 changed files with 5 additions and 3 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Use Element.update('id', 'html') instead of $('id').innerHTML = 'html' in JavaScriptGenerator#replace_html so that script tags are evaluated. [Sam Stephenson]
* Make rjs templates always implicitly skip out on layouts. [Marcel Molina Jr.]
* Correct length for the truncate text helper. #2913 [Stefan Kaes]

View file

@ -425,7 +425,7 @@ module ActionView
#
def replace_html(id, *options_for_render)
html = render(*options_for_render)
record "$(#{id.inspect}).innerHTML = #{html.inspect}"
record "Element.update(#{id.inspect}, #{html.inspect})"
end
# Removes the DOM elements with the given +ids+ from the page.

View file

@ -167,7 +167,7 @@ class JavaScriptGeneratorTest < Test::Unit::TestCase
end
def test_replace_html_with_string
assert_equal '$("element").innerHTML = "<p>This is a test</p>";',
assert_equal 'Element.update("element", "<p>This is a test</p>");',
@generator.replace_html('element', '<p>This is a test</p>')
end
@ -202,7 +202,7 @@ class JavaScriptGeneratorTest < Test::Unit::TestCase
new Insertion.Top("element", "<p>This is a test</p>");
new Insertion.Bottom("element", "<p>This is a test</p>");
["foo", "bar"].each(Element.remove);
$("baz").innerHTML = "<p>This is a test</p>";
Element.update("baz", "<p>This is a test</p>");
EOS
end
end