NYCPHP Meetup

NYPHP.org

[nycphp-talk] JSON and MVC

Chris Snyder chsnyder at gmail.com
Fri Jul 17 11:03:05 EDT 2009


On Fri, Jul 17, 2009 at 10:06 AM, Christopher Hendry<chendry at gmail.com> wrote:

> I'm curious though about javascript's introspection abilities, might it be
> possible for an element to look into itself (or clone its children) and
> render from there?

Yes! I've seen schemes that used class names (<span
class="data_subject">) or custom attributes (data_element="subject")
like you used in your example. If you've managed to escape the tyranny
of strict markup, then custom attributes probably make the most sense.

> Overall, I still use innerHTML for the most part, unless I'm doing something
> that is strictly key=>values (like select elements) mostly because I'm still
> concerned about the client's parsing abilities.  Sure, _we_ all have sleek
> computers and fast browsers, but most people don't.  So, yes, offloading to
> the client makes sense (until the next browser comes along and screws things
> up), but as we approach Web 3.0 I'm concerned about
> request/response/parse/render overhead for the average user - sure it
> scales, until the next version on windows comes out.

The only disadvantage I've seen to wanton innerHTML replacement is
that you lose any events or listeners that you might have attached in
the soup somewhere. Maybe other folks have other reasons, besides just
an irrational love of DOM methods.



More information about the talk mailing list