diff --git a/CHANGELOG b/CHANGELOG index a16d7a7..b995849 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Fix issue where Function#argumentNames returned incorrect results in IE when comments were intermixed with argument names. (Christophe Porteneuve, T.J. Crowder) + * Performance improvements in Function methods (Samuel Lebeau, kangax, jddalton, Tobie Langel). *1.6.0.3* (September 29, 2008) diff --git a/src/lang/function.js b/src/lang/function.js index df2f737..e73a01e 100644 --- a/src/lang/function.js +++ b/src/lang/function.js @@ -13,7 +13,8 @@ Object.extend(Function.prototype, (function() { } function argumentNames() { - var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1] + var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1] + .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '') .replace(/\s+/g, '').split(','); return names.length == 1 && !names[0] ? [] : names; }