Ticket #7890 (closed enhancement: fixed)
add support for inserting html fragments in DOM ("dojo.html.insert")
| Reported by: | mikewse | Owned by: | elazutkin |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3 |
| Component: | HTML | Version: | 1.2.0 |
| Severity: | normal | Keywords: | |
| Cc: | elazutkin, dante |
Description
There is currently no support in Dojo for inserting HTML fragments at flexible locations like IE's insertAdjacentHtml does. Syntax is
elem.insertAdjacentHTML(placement, html)
placement = {beforeBegin|afterBegin|beforeEnd|afterEnd}
See http://msdn.microsoft.com/en-us/library/ms536452(VS.85).aspx
Prototype implements this feature cross-browser as Element.insert() with f ex the following syntax:
Element.insert(elem, {placement: html})
See http://www.prototypejs.org/api/element/insert
As suggested by jburke it is probably a good idea to line up with dojo.place syntax (and possibly the withdrawn-just-before-1.2 dojo.elem) and get something like:
dojo.html.insert(html, elem, placement)
placement = {before|after|first|last}
(placement uses constants from dojo.place)
The feature is great to use for working with templating of different kinds so it would be really nice to have it implemented in Dojo.