Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2795

Wicket removes first dollar from $$ markups with TextTemplate's interpolate() while $$ are commonly used in JavaScript libraries

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 1.4.6
    • None
    • wicket
    • Windows XP SP3, Apache Jetty 6.1.22

    Description

      Many JavaScript libraries such as jQuery and MooTools use $$ to find out arrays of elements. Having $$('blaa') is currently replaced by Wicket into $('blaa'). Wanted behavior is to replace all $${...} with ${...}, not $$ with $.

      Possible fix (don't really have time to look at this atm):

      org.apache.wicket.util.template.VariableInterpolator:

      Row 111:

      while ((start = lowerPositive(string.indexOf("$$", pos), string.indexOf("${", pos))) != -1)
      {
      // Append text before possible variable
      buffer.append(string.substring(pos, start));

      if (string.charAt(start + 1) == '$')

      { buffer.append("$"); pos = start + 2; continue; }

      ...

      Shoud be changed to:

      while ((start = lowerPositive(string.indexOf("$${", pos), string.indexOf("${", pos))) != -1)
      {
      // Append text before possible variable
      buffer.append(string.substring(pos, start));

      if (string.charAt(start + 1) == '$' && string.charAt(start + 2) == '{')
      {
      buffer.append("${");
      pos = start + 3;
      continue;
      }
      ...

      (no JIRA markup for rich formatting available? uh)

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            tuukka.mustonen Tuukka Mustonen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: