Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-669

DatePicker.js line 781 javascript error when Array is customized using Prototype.js from http://prototype.conio.net/

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Windows XP, Internet Explorer 6

      Description

      Line 781 in DatePicker.js fails when thirdparty methods are added to Array using Prototype.js from http://prototype.conio.net/
      For example if you add the flatten method from http://www.schuerig.de/michael/javascript/stdext.js
      then line 781 will attempt to execute the "frm.replace(/\bflatten\b/,'function(excludeUndefined)

      {return Array.flatten(this, excludeUndefined);}

      ');"
      Suggested modification to DatePicker.js:
      var keys = new Array('d','dd','ddd','dddd','M','MM','MMM','MMMM','yyyy','yy');
      for (var i = 0; i < keys.length; i++)

      { frm = eval("frm.replace(/\\b" + keys[i] + "\\b/,'" + bits[keys[i]] + "');"); }

      // borrowed from http://www.schuerig.de/michael/javascript/stdext.js
      // Copyright (c) 2005, Michael Schuerig, michael@schuerig.de

      Array.flatten = function(array, excludeUndefined) {
      if (excludeUndefined === undefined)

      { excludeUndefined = false; }

      var result = [];
      var len = array.length;
      for (var i = 0; i < len; i++) {
      var el = array[i];
      if (el instanceof Array)

      { var flat = el.flatten(excludeUndefined); result = result.concat(flat); }

      else if (!excludeUndefined || el != undefined)

      { result.push(el); }

      }
      return result;
      };

      if (!Array.prototype.flatten) {
      Array.prototype.flatten = function(excludeUndefined)

      { return Array.flatten(this, excludeUndefined); }

      }

        Attachments

          Activity

            People

            • Assignee:
              hlship Howard M. Lewis Ship
              Reporter:
              yahui168 Herbert Hui
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: