tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Herbert Hui (JIRA)" <tapestry-...@jakarta.apache.org>
Subject [jira] Created: (TAPESTRY-669) DatePicker.js line 781 javascript error when Array is customized using Prototype.js from http://prototype.conio.net/
Date Tue, 27 Sep 2005 00:46:47 GMT
DatePicker.js line 781 javascript error when Array is customized using Prototype.js from http://prototype.conio.net/
--------------------------------------------------------------------------------------------------------------------

         Key: TAPESTRY-669
         URL: http://issues.apache.org/jira/browse/TAPESTRY-669
     Project: Tapestry
        Type: Bug
  Components: Framework  
    Versions: 4.0    
 Environment: Windows XP, Internet Explorer 6
    Reporter: Herbert Hui
    Priority: Minor


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);
  }
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message