mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix HTML::Node to output double quotes instead of single quotes. Closes #6845 [mitreandy]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5718 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
011f4e7413
commit
d833645cd8
3 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Fix HTML::Node to output double quotes instead of single quotes. Closes #6845 [mitreandy]
|
||||||
|
|
||||||
* Correctly report which filter halted the chain. #6699 [Martin Emde]
|
* Correctly report which filter halted the chain. #6699 [Martin Emde]
|
||||||
|
|
||||||
* Fix a bug in Routing where a parameter taken from the path of the current request could not be used as a query parameter for the next. Closes #6752. [Nicholas Seckar]
|
* Fix a bug in Routing where a parameter taken from the path of the current request could not be used as a query parameter for the next. Closes #6752. [Nicholas Seckar]
|
||||||
|
|
|
@ -316,7 +316,7 @@ module HTML #:nodoc:
|
||||||
s = "<#{@name}"
|
s = "<#{@name}"
|
||||||
@attributes.each do |k,v|
|
@attributes.each do |k,v|
|
||||||
s << " #{k}"
|
s << " #{k}"
|
||||||
s << "='#{v.gsub(/'/,"\\\\'")}'" if String === v
|
s << "=\"#{v}\"" if String === v
|
||||||
end
|
end
|
||||||
s << " /" if @closing == :self
|
s << " /" if @closing == :self
|
||||||
s << ">"
|
s << ">"
|
||||||
|
|
|
@ -204,7 +204,7 @@ class TextHelperTest < Test::Unit::TestCase
|
||||||
def test_sanitize_form
|
def test_sanitize_form
|
||||||
raw = "<form action=\"/foo/bar\" method=\"post\"><input></form>"
|
raw = "<form action=\"/foo/bar\" method=\"post\"><input></form>"
|
||||||
result = sanitize(raw)
|
result = sanitize(raw)
|
||||||
assert_equal "<form action='/foo/bar' method='post'><input></form>", result
|
assert_equal %(<form action="/foo/bar" method="post"><input></form>), result
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sanitize_plaintext
|
def test_sanitize_plaintext
|
||||||
|
@ -216,25 +216,25 @@ class TextHelperTest < Test::Unit::TestCase
|
||||||
def test_sanitize_script
|
def test_sanitize_script
|
||||||
raw = "<script language=\"Javascript\">blah blah blah</script>"
|
raw = "<script language=\"Javascript\">blah blah blah</script>"
|
||||||
result = sanitize(raw)
|
result = sanitize(raw)
|
||||||
assert_equal "<script language='Javascript'>blah blah blah</script>", result
|
assert_equal %{<script language="Javascript">blah blah blah</script>}, result
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sanitize_js_handlers
|
def test_sanitize_js_handlers
|
||||||
raw = %{onthis="do that" <a href="#" onclick="hello" name="foo" onbogus="remove me">hello</a>}
|
raw = %{onthis="do that" <a href="#" onclick="hello" name="foo" onbogus="remove me">hello</a>}
|
||||||
result = sanitize(raw)
|
result = sanitize(raw)
|
||||||
assert_equal %{onthis="do that" <a name='foo' href='#'>hello</a>}, result
|
assert_equal %{onthis="do that" <a name="foo" href="#">hello</a>}, result
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sanitize_javascript_href
|
def test_sanitize_javascript_href
|
||||||
raw = %{href="javascript:bang" <a href="javascript:bang" name="hello">foo</a>, <span href="javascript:bang">bar</span>}
|
raw = %{href="javascript:bang" <a href="javascript:bang" name="hello">foo</a>, <span href="javascript:bang">bar</span>}
|
||||||
result = sanitize(raw)
|
result = sanitize(raw)
|
||||||
assert_equal %{href="javascript:bang" <a name='hello'>foo</a>, <span>bar</span>}, result
|
assert_equal %{href="javascript:bang" <a name="hello">foo</a>, <span>bar</span>}, result
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sanitize_image_src
|
def test_sanitize_image_src
|
||||||
raw = %{src="javascript:bang" <img src="javascript:bang" width="5">foo</img>, <span src="javascript:bang">bar</span>}
|
raw = %{src="javascript:bang" <img src="javascript:bang" width="5">foo</img>, <span src="javascript:bang">bar</span>}
|
||||||
result = sanitize(raw)
|
result = sanitize(raw)
|
||||||
assert_equal %{src="javascript:bang" <img width='5'>foo</img>, <span>bar</span>}, result
|
assert_equal %{src="javascript:bang" <img width="5">foo</img>, <span>bar</span>}, result
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_cycle_class
|
def test_cycle_class
|
||||||
|
|
Loading…
Reference in a new issue