rails/actionview/app/assets/javascripts/rails-ujs
Raymond Zhou 48e44edfd0 Pass HTML responses as plain-text in rails-ujs
Running HTML responses through `DOMParser#parseFromString` results in
complete `HTMLDocument` instances with unnecessary surrounding tags.

For example:

    new DOMParser().parseFromString('<p>hello</p>', 'text/html')

Will output:

    <html>
      <head></head>
      <body>
        <p>hello</p>
      </body>
    </html>

This is passed to the `ajax:success` handler as `event.detail[0]`
(`data`), but cannot be used directly without first traversing the
document.

To resolve this, only XML content is passed through `parseFromString`,
while HTML content is treated as plain-text.

This matches the behavior of jquery-ujs, which relied on jQuery's
response-type inference.
2018-03-19 03:24:56 -04:00
..
features Fix callback in rails ujs 2017-06-07 08:33:33 +03:00
utils Pass HTML responses as plain-text in rails-ujs 2018-03-19 03:24:56 -04:00
BANNER.js Reorganize rails-ujs files 2017-03-30 14:41:17 -04:00
start.coffee Check for jQuery ajax 2017-05-19 22:42:02 +03:00