John Resig wrote:
> Well, you could also do:
> $("h1").prepend("ยง");
Yeah. I didn't mean to imply that my code was a serious use-case. Its
just where I tripped myself up, thinking I could create a jQuery object
that held "html" text that didn't happen to have any angle brackets in
it :-). It was kind of surprising to realize that I needed to call
createTextNode explicitly in that case. And so I proposed this syntax
as a cool shortcut for createTextNode()
> The reasoning behind handling selectors (and HTML) in $(...) and then
> later appending/prepending/etc. them into the document is that you can
> modify them in the interim.
>
> For example:
> $("<h1>Something</h1>").click(function(){ .... }).prependTo("div.section");
That's pretty cool. I think I would have assumed that elements had to
be inserted before doing other things with them.
> Whereas there's really no associated use case for pure text nodes
So I guess you're saying that there shouldn't be a need to work with
text nodes, so no shortcut is necessary. Fair enough.
David
> --John
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---