Opened 11 years ago

Closed 11 years ago

#1296 closed defect (fixed)

Words in brackets, e.g., [foo], will be replaced with dialog IDs

Reported by: nicholasbs Owned by: gogo
Priority: normal Milestone: 0.96
Component: Xinha Core Version: trunk
Severity: minor Keywords:
Cc:

Description

The regex used in XinhaDialog?.js casts the net a little too wide:

  html = html.replace(/\[([a-z0-9_]+)\]/ig,
    function(fullString, id)
    {
      if(typeof dialog.id[id] == 'undefined')
      {
        dialog.id[id] = Xinha.uniq('Dialog');
        dialog.r_id[dialog.id[id]] = id;
      }
      return dialog.id[id];
    }
    [SNIP]

This will replace any alphanumeric string (without spaces but including underscores) with a unique dialog ID, e.g., Dialog24. This works for making element IDs unique in a dialog, but it could also screw up other text.

The regex should be updated to look for strings of the form id="[bah]" or name='[foo]' instead.

Change History (1)

comment:1 Changed 11 years ago by nicholasbs

  • Resolution set to fixed
  • Status changed from new to closed

Changeset r1087 fixes this problem by strengthening the regex.

Note: See TracTickets for help on using tickets.