Skip to content

Javascript escaping not compatible with Rails #14

@joe1chen

Description

@joe1chen

Hi,
I'm looking into a bug (brianmario/escape_utils#43) with the escape_utils gem, which relies on houdini.

The problem is that escape_utils relies on houdini's escape javascript function, which currently doesn't seem to be compatible with the typical Rails use-case.

The Rail's escape_javascript function currently escapes carriage returns and single and double quotes for JavaScript segments. The typical use case is something like this:

$('some_element').replaceWith('<%=escape_javascript render 'some/element_template' %>');

The HTML output of the render call is escaped so that it is valid as a Javascript string.

Is it possible to change the current houdini javascript escape function to behave similarly? Or add options so that a Rails-compatible javascript escape is exposed? This would fix the bug in escape_utils.

Or if not, can you explain what the typical use case is for the existing escape javascript function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions