From 62a1f7e2ce28e6790040c8558a35c693b37abced Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Sun, 26 Oct 2008 15:33:10 -0500 Subject: [PATCH] Fix issue where Function#argumentNames returned incorrect results in IE when comments were intermixed with argument names. [#397 state:resolved] --- CHANGELOG | 2 ++ src/lang/function.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) 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; }