innerHTML VS W3C DOM

April 14th, 2006

Several people have pointed to the battle between innerHTML and W3C DOM methods (createElement) today.

The Web Standard Project points to DomBuilder which it calls an "elegant lightweight script". DomBuilder lets you build a DOM without using document.createElement, setAttribute calls, and loads of code which can make your code really hard to understand. Instead you do something like:

P({ 'class' : 'warning' },  // if you are specifying a class attribute quote it..it's a reserved word  STRONG("WARNING:"), " I am extremely lazy.");

Still, innerHTML is a ton faster than W3C DOM. 

About the Author: Hi! I'm Ken. I've been using mobiles for over 10 years and technology for a lot longer! I'd love to hear from you.

Like this tip? Get the most from your mobile phone...

  • Discover brand new ways to use your mobile phone
  • Techniques to get more out of your mobile phone for less
  • Be the first to learn about new mobile technology

Enter your email to receive free regular Ken's Tech Tips:

  1. HTML/Javascript Levels
  2. Creating Microsummaries (How to & Evo)
  3. document.getElementsByClassName compatibility
  4. Internet Explorer Javascript Errors
  5. Simple, Accessible Image Scroller

Trackback URI | Comments RSS

Leave a Reply