Opened 16 years ago

Closed 16 years ago

#975 closed defect (invalid)

dojo.html.createNodesFromText uses innerHTML

Reported by: [email protected] Owned by: anonymous
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked By: Blocking:


dojo.html.createNodesFromText uses innerHTML to do its work. This turned out to cause problems for me in explorer - I created a string with a <ul> in it, with each of the <li>'s containing an <a href="javascript:..."> link. This didn't work properly in Explorer 6 - the hyperlinks were not inserted, due to a bug in the explorer implements innerHTML. I thought the point of having a dojo method for stuff like this was that it works properly on all browsers and (i guess) preferably shouldn't use deprecated methods like innerHTML. Whether this is a bug is a matter of opinion I guess, but it would have been better for me if this function parsed the html string it was passed and built up a node tree using DOM calls.

Change History (1)

comment:1 Changed 16 years ago by Tom Trenka

Resolution: invalid
Status: newclosed


dojo.html.createNodesFromText isn't intended to be an HTML parser; it is aimed at taking plain text and creating an output in HTML for them. In fact, if anything this particular method should try to escape any HTML passed to it first (but IIRC there are other methods for doing that).

If you're looking to do something like create a string of HTML and have a browser render it, you should probably use innerHTML.

Marking as invalid.

Note: See TracTickets for help on using tickets.