On Jun 21, 2:35 pm, sed <[EMAIL PROTECTED]> wrote:
> I'm not sure why this worked before, it must be related to the html/
> script being generated into the div from the ajax.updater rather than
> just being on the page.

Nope. It's sillier than that. Let's say you've got an element with an
ID of "foo" on the page:

var f = new String("foo");
$(f); //-> null
document.getElementById('foo') //-> [object HTMLElement]

This can be traced to JavaScript's bizarre String constructor --
`typeof f` returns "object", not "string". Looking at `f` in Firebug
will reveal "['f', 'o', 'o']". This is a crack in the object/primitive
duality of types like String and Number.

The $ function uses the "typeof" operator to figure out if the passed
argument is a string. Since it doesn't appear to be one, it doesn't
get run through document.getElementById.

You've found the solution already -- the "new String" call is
superfluous.

Cheers,
Andrew


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to