Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Beta2
    • Fix Version/s: 2.0.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ACE

      Description

      The ACE components use JSON escaping to pass parameters from the server to the client, specifically the JSProps and JSFProps parameters. The string escaping adds quotes, and escapes quotes, but also escapes backslashes and forward slashes. In the browser, the escape sequence for the forward slashes remains, as evidenced by inspecting the thumbUrl property on sliderEntry. We need to do some escaping, so that javascript values can exist within an html tag's attribute value.

      The solution need not specifically be JSON. We could do less escaping, that's non-JSON, or we could use YUI code to JSON unescape the values.

        Activity

        Hide
        Mark Collette added a comment -

        This is the code in JSONBuilder that causes the issue. This illustrates the need for JSON unescaping in the browser.

        public JSONBuilder entry(String key, String value, boolean isStringLiteral)

        { ... value = value.replace("/", "\\/"); ... }
        Show
        Mark Collette added a comment - This is the code in JSONBuilder that causes the issue. This illustrates the need for JSON unescaping in the browser. public JSONBuilder entry(String key, String value, boolean isStringLiteral) { ... value = value.replace("/", "\\/"); ... }
        Hide
        Ken Fyten added a comment -

        Try to leverage a YUI3 utility for JSON string unescaping in the client.

        Show
        Ken Fyten added a comment - Try to leverage a YUI3 utility for JSON string unescaping in the client.
        Hide
        yip.ng added a comment - - edited

        var JSON = YAHOO.lang.JSON,
        var jsonStr = JSON.stringify(jsProps, ["selectedDate"]);
        console.log(jsonStr);
        var selectedDate = JSON.parse(jsonStr).selectedDate;
        console.log(selectedDate);

        See screenshots 1 and 2 for the input and output.

        To process all values, leave out 2nd param. in stringify().

        To process multiple specific values, add key names to the 2nd param. (array of key names) in stringify().

        (But date time entry works fine even without going through all these.)

        Show
        yip.ng added a comment - - edited var JSON = YAHOO.lang.JSON, var jsonStr = JSON.stringify(jsProps, ["selectedDate"] ); console.log(jsonStr); var selectedDate = JSON.parse(jsonStr).selectedDate; console.log(selectedDate); See screenshots 1 and 2 for the input and output. To process all values, leave out 2nd param. in stringify(). To process multiple specific values, add key names to the 2nd param. (array of key names) in stringify(). (But date time entry works fine even without going through all these.)

          People

          • Assignee:
            yip.ng
            Reporter:
            Mark Collette
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: