[Greasemonkey] innerHTML: is this good?

carlos campderrós gilipollas.desconcertante at gmail.com
Sat Jul 8 15:04:30 EDT 2006


Hi everybody.

In my first userscript I used innerHTML to add content to a web. Some
time later I read somewhere that innerHTML was evil, non-standard and
not DOM-ish, so better to not use it. Then I replaced the innerHTML
with lots of document.createElement(), element.setAttribute() and
element.appendChild(), that is really tiring and somehow ofuscates the
code.

Yesterday I took a look at dive into greasemonkey book and saw an
example with innerHTML. My life is a mess now ;-)

Will, sometime in the future, innerHTML become standard? Will firefox
and greasemonkey support it forever? Is safe to use it?

And talking about performance. Which way is better: innerHTML or lots
of createElement and so?

Long question short: What are the pros and cons of using either
innerHTML or document.createElement... ?

-- 
Si no puedes deslumbrar con tu inteligencia,
desconcierta con tus gilipolleces


More information about the Greasemonkey mailing list