PDA

View Full Version : have a probem with createTextNode



Dennis_Gull
08-03-2007, 07:52 AM
Hello, im trying to make a rss reader using DOM to populate it but I got a problem. I used this code for the description:
var desc = createTextNode(<the description array>);

But some sites have extra tags in the description tag such as pictures and links so if i generate it as a text node I will get the tags as text like this:
some random description <img ... /> <a href.... >link</a>
instead of:
some random description <the real image> <the real link>

I solved this with innerHTML but i was just wondering if theres another way to deal with this?

Twey
08-03-2007, 08:30 AM
innerHTML is the best way here. You could write your own HTML parser (and if you've got time, by all means do and use it as a backup in case innerHTML isn't available) but the native parser will always surpass it by far in terms of speed.