Re: Creating a new element and inserting before an existing causes line breaks
Jeremy L <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <b5b1b8d8-5148-4c45-b865-b1771d8a847e@f63g2000hsf.googlegroups.com> |
This is what I have:
var ciscouc_scope = "//text()[(parent::" + tag + ")]";
var cisco_potentials =
objEvent.originalTarget.evaluate(ciscouc_scope,
objEvent.originalTarget, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var cisco_element = null, elemnum = 0; ((cisco_abort==0) &&
(cisco_element = cisco_potentials.snapshotItem(elemnum))); elemnum++)
{
var cisco_newcode = document.createElement("div"); // Make new code
snippit
var cisco_icon = document.createElement("div");
newstyle="display: compact; width: 13px; height: 13px; background:
url('" + ciscouc_presence + cisco_oldcode + "') center no-repeat";
cisco_icon.setAttribute("style",newstyle);
var cisco_href = document.createElement("a");
cisco_href.setAttribute("href", "#");
cisco_href.setAttribute("cisco_phone", cisco_oldcode);
cisco_href.addEventListener("click", Cisco_PClick, true);
cisco_href.appendChild(cisco_icon);
cisco_element.parentNode.insertBefore(cisco_href, cisco_element);
}