    # File lib/action_controller/assertions/selector_assertions.rb, line 595
            def response_from_page_or_rjs()
              content_type = @response.content_type

              if content_type && Mime::JS =~ content_type
                body = @response.body.dup
                root = HTML::Node.new(nil)

                while true
                  next if body.sub!(RJS_STATEMENTS[:any]) do |match|
                    html = unescape_rjs(match)
                    matches = HTML::Document.new(html).root.children.select { |n| n.tag? }
                    root.children.concat matches
                    ""
                  end
                  break
                end

                root
              else
                html_document.root
              end
            end