提交 2674fe38 编写于 作者: R razh

Revert "Pass HTML responses as plain-text in rails-ujs"

This reverts commit 48e44edf.

See discussion in #32287

For HTML content in `ajax:success` handlers, `event.detail[0]` should
be an `HTMLDocument` instance.
上级 98e380f0
......@@ -69,7 +69,7 @@ processResponse = (response, type) ->
script.setAttribute('nonce', cspNonce())
script.text = response
document.head.appendChild(script).parentNode.removeChild(script)
else if type.match(/\bxml\b/)
else if type.match(/\b(xml|html|svg)\b/)
parser = new DOMParser()
type = type.replace(/;.+/, '') # remove something like ';charset=utf-8'
try response = parser.parseFromString(response, type)
......
......@@ -128,17 +128,6 @@ asyncTest('execution of JS code does not modify current DOM', 1, function() {
})
})
asyncTest('HTML content should be plain-text', 1, function() {
buildForm({ method: 'post', 'data-type': 'html' })
$('form').append('<input type="text" name="content_type" value="text/html">')
$('form').append('<input type="text" name="content" value="<p>hello</p>">')
submit(function(e, data, status, xhr) {
ok(data === '<p>hello</p>', 'returned data should be a plain-text string')
})
})
asyncTest('XML document should be parsed', 1, function() {
buildForm({ method: 'post', 'data-type': 'html' })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册