Better DHTML

So on the IE Blog, they shared a link about writing better DHTML for IE. So I followed to see if there was anything smugmug could do to make our pages shine even brighter. What I did learn about was the MSIE proprietary reference of outerHTML.

You do remember my previous post about using innherHTML to replace lines you did not like, right? Well outerHTML can be used to replace even the container around the code that you want.

I think that this is a very smart way to reference data, but would love a method that would work cross platform, does anyone know of a similar way?

4 Responses to “Better DHTML”

  1. Mike Lane Says:

    Right, so everything that I’ve found says that outerhtml is an IE proprietary tag that (unlike the also proprietary innerhtml) has not been supported by firefox. Actually some sites hint that may not actually be so and others hint at a workaround (without actually providing the workaround mind you).

    So, have you a clear answer on that subject by chance? If a workaround is required, can you tell us what it is (or at least where to find it)?

  2. Mike Lane Says:

    You may find this interesting: http://dean.edwards.name/moz-behaviors/compatibility/

  3. Daniel Baird Says:

    Be careful about using innerHTML and outerHTML. These methods in IE are really bad for page performance. Whenever possible, set the styles of your containers with CSS, and then replace the contents with innerText. It is WAY faster in IE. Firefox doesn’t have the same problem (better handling of strings in general in Firefox script land).

    Oh…and to answer a possible, “how do I know that?” question. I’m the Web UI lead for Yahoo! Music (formerly Musicmatch). All of the UI stuff for the services part of the products is AJAX style scripting. I’ve been doing this for the last 4 years.

  4. Administrator Says:

    Daniel, thanks for the info. For the most part at smugmug we keep our use of innerhtml to a bare minimum (in fact, we usually hide blocks instead), but for our pros that will end up using innerhtml to repalce large sections of their sites I am sure that using innertext will prove to be better. I will make a note to reference using it in all future posts that use innerhtml.

Leave a Reply