[Greasemonkey] Arrgghh!!! it runs asynch!!!
Jeremy Dunck
jdunck at gmail.com
Wed Jun 28 09:22:37 EDT 2006
On 6/28/06, Tom Emerson <osnut at pacbell.net> wrote:
> (this brings up another headache that makes no sense -- the program gets
> "the entire raw response" in a string as follows:
>
> onload: function(responseDetails) {
> var refText = responseDetails.responseText;
>
> and refText.match(/some-expression/) works.
>
> If I then try to do this:
>
> var newIMG = refText.match(/some extraction/g);
> var imgWidth = newIMG.match(/some sub-extraction/g);
>
> I get the error that "newIMG.match" is not a function. Several trials
> later I hit upon the solution above, but the inconsistency drove me nuts
> for quite some time)
The response is a string, which has a match method. The match method
is a convenience over RegExp.prototype.exec, which returns an array of
groupings. An array doesn't have a match method. :)
What behavior wouldn't have driven you nuts?
(FYI, Firebug, JS Shell, and ECMA 262 are your friends.)
http://www.joehewitt.com/software/firebug/
http://www.squarefree.com/bookmarklets/webdevel.html
http://www.ecma-international.org/publications/standards/Ecma-262.htm
More information about the Greasemonkey
mailing list