Bug Tracker

Modify

Ticket #9439 (closed enhancement: duplicate)

Opened 2 years ago

Last modified 2 years ago

Better definition for jq escaping script

Reported by: ottuzzi Owned by:
Priority: low Milestone: 1.next
Component: selector Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

Hi,

on page[1] you can see the proposed jq script to escape period and colon characters as they are problematic as css selectors: I found that even $,{ and } need to be correctly escaped.

Here is the proposed change:

function jq(myId) {
   return '#' + myId.replace(/(:|\.|\{|\}|\$)/g,'\\$1');
}

Please let me know what you think about this change.

Thanks Bye Piero

[1] http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_by_an_ID_that_has_characters_used_in_CSS_notation.3F

Change History

comment:1 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to duplicate
  • Status changed from new to closed
  • Component changed from unfiled to selector

comment:2 Changed 2 years ago by rwaldron

Duplicate of #5241.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.