Skip to content

CSS selector escape function should escape foward slashes #758

Closed
@schlimmchen

Description

@schlimmchen

I am using id attributes with values containing forward slash characters: '/'.

The function presented in https://github.com/jquery/learn.jquery.com/blob/master/page/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation.md should also escape forward slashes, which seems neccessary for the seletor to work:

return "#" + id.replace(/(\/|:|\.|\[|\]|,|=|@)/g, "\\$1")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions