Cocoon
  1. Cocoon
  2. COCOON-1771

cocoon.ajax.Fader runtime error when style uses abreviated form #ccc in IE6.0sp2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.8
    • Fix Version/s: None
    • Component/s: Blocks: Ajax
    • Labels:
      None
    • Urgency:
      Normal
    • Other Info:
      Patch available

      Description

      In cocoon.ajax.Fader

        this.toColor = cocoon.ajax.Fader.colorToRgb(cocoon.ajax.Fader.getBgColor(this.element));

      getBgColor will return '#fff'

      /** Converts a "#RRGGBB" color as an array of 3 ints */
      cocoon.ajax.Fader.colorToRgb = function(hex) {
          return [
              parseInt(hex.substr(1,2),16),
              parseInt(hex.substr(3,2),16),
              parseInt(hex.substr(5,2),16) ];
      }

      Assumes that hex starts with a '#' and has 6 additional hex characters.

      The corrected implementation is

      /** Converts a "#RRGGBB" color as an array of 3 ints */
      cocoon.ajax.Fader.colorToRgb = function(hex) {
      var r = 255; // defaults if no match
      var g = 255;
      var b = 255;
      var i=-1;
      var colors = hex.match(/^#(\d{2})(\d{2})(\d{2})$/);
      if (colors) {
      r = parseInt(colors[++i]);
      g = parseInt(colors[++i]);
      b = parseInt(colors[++i]);
      } else if (colors = hex.match(/^#(\d)(\d)(\d)$/)) {
      r = parseInt(colors[++i] + colors[i]);
      g = parseInt(colors[++i] + colors[i]);
      b = parseInt(colors[++i] + colors[i]);
      }
          return [r,g,b];
      }

      Patch attached.

      Regards,
      Eric Meyer, VP, Quoin, Inc.
      1. ASF.LICENSE.NOT.GRANTED--cocoon-ajax.js.patch
        0.9 kB
        Eric Meyer
      2. cocoon-ajax.js.patch
        2 kB
        Eric Meyer
      3. cocoon-ajax.js.patch
        2 kB
      4. cocoon-ajax.js.patch
        1 kB
        Eric Meyer

        Activity

        Eric Meyer created issue -
        Antonio Gallardo made changes -
        Field Original Value New Value
        Assignee Antonio Gallardo [ antonio ]
        Hide
        Eric Meyer added a comment -
        Fixed doc comment and added mechanism to pass default color in case of no matching regexp.
        Show
        Eric Meyer added a comment - Fixed doc comment and added mechanism to pass default color in case of no matching regexp.
        Eric Meyer made changes -
        Attachment cocoon-ajax.js.patch [ 12322738 ]
        made changes -
        Attachment cocoon-ajax.js.patch [ 12322743 ]
        Hide
        Upayavira added a comment -
        This patch came in as "anonymous", therefore we cannot accept it, as its provenance cannot be proven. Please resubmit it while logged into jira.
        Show
        Upayavira added a comment - This patch came in as "anonymous", therefore we cannot accept it, as its provenance cannot be proven. Please resubmit it while logged into jira.
        Hide
        Eric Meyer added a comment -
        Pulled in another patch that fixes a NPE in
        /**
         * System-wide handlers
         */
        cocoon.ajax.BrowserUpdater.handlers

        this may already be on the dev trunk, but it's not in the 2.1.8 release vesion.
        Show
        Eric Meyer added a comment - Pulled in another patch that fixes a NPE in /**  * System-wide handlers  */ cocoon.ajax.BrowserUpdater.handlers this may already be on the dev trunk, but it's not in the 2.1.8 release vesion.
        Eric Meyer made changes -
        Attachment cocoon-ajax.js.patch [ 12322750 ]
        Hide
        Antonio Gallardo added a comment -
        Upayavira, may I remove the "anonymous" attach?
        Show
        Antonio Gallardo added a comment - Upayavira, may I remove the "anonymous" attach?
        Hide
        Upayavira added a comment -
        No need. Just make sure that the one you use was uploaded by a known individual who clicked the "grant license" button.
        Show
        Upayavira added a comment - No need. Just make sure that the one you use was uploaded by a known individual who clicked the "grant license" button.
        Hide
        Antonio Gallardo added a comment -
        Thanks for the patch. It was applied with minor changes. Please cross check and close the bug.
        Show
        Antonio Gallardo added a comment - Thanks for the patch. It was applied with minor changes. Please cross check and close the bug.
        Antonio Gallardo made changes -
        Status Open [ 1 ] On Hold [ 10000 ]
        Hide
        Eric Meyer added a comment -
        Thank you, Antonio, for working with me to apply the patch.
        Show
        Eric Meyer added a comment - Thank you, Antonio, for working with me to apply the patch.
        Eric Meyer made changes -
        Resolution Fixed [ 1 ]
        Status On Hold [ 10000 ] Closed [ 6 ]

          People

          • Assignee:
            Antonio Gallardo
            Reporter:
            Eric Meyer
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development