remove contents of script and style elements

Avoids rendering HTML-ized CSS and/or Javascript by removing the
contents of script and style elements as well as the elements
themselves.

/cc @technoweenie

Pull Request: master
This commit is contained in:
Jesse Newland
2012-01-08 22:07:33 -05:00
parent 5163f11ecb
commit be4c52202c
2 changed files with 39 additions and 14 deletions
+12
View File
@@ -459,6 +459,18 @@ np.array([[2,2],[1,3]],np.float)
compare(content, output)
end
test "removes style blocks completely" do
content = "<style>body { color: red }</style>foobar"
output = "<p>foobar</p>"
compare(content, output)
end
test "removes script blocks completely" do
content = "<script>alert('hax');</script>foobar"
output = "<p>foobar</p>"
compare(content, output)
end
test "escaped wiki link" do
content = "a '[[Foo]], b"
output = "<p>a [[Foo]], b</p>"