[ 
https://issues.apache.org/jira/browse/WICKET-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tuukka Mustonen updated WICKET-2795:
------------------------------------

    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)

  was:
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;
                        }
                ...


> Wicket removes first dollar from $$ markups with TextTemplate's interpolate() 
> while $$ are commonly used in JavaScript libraries
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2795
>                 URL: https://issues.apache.org/jira/browse/WICKET-2795
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.6
>         Environment: Windows XP SP3, Apache Jetty 6.1.22
>            Reporter: Tuukka Mustonen
>
> 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)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to