Speed up Function#argumentNames. Avoid Enum dependency.

This commit is contained in:
Tobie Langel 2008-05-05 09:21:46 +02:00
parent b75bc189ec
commit de5cc4a0f9
2 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* Speed up Function#argumentNames. Avoid Enum dependency. (samleb, Tobie Langel)
* Fix Event#element accessing inexistent tagName property (e.g. when element is a document). (kangax)
* Amended failing Element#identify test.

View File

@ -159,7 +159,7 @@ Object.extend(Object, {
Object.extend(Function.prototype, {
argumentNames: function() {
var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(/\s*,\s*/);
return names.length == 1 && !names[0] ? [] : names;
},