Note that there are some explanatory texts on larger screens.

plurals
  1. POHow could I apply the class or the style to some HTML element in IE?
    text
    copied!<p>I'm doing an application that has to parse elements in an XML tree to HTML and in all the browsers it goes well but IE doesn't want to apply the styles to the elements. How could I fix this?</p> <pre><code>function add2Doc(elmnt, domDoc, newEl) { /* * This function transform an * element to into the an acceptable * part of another document, I know * exist some beatiful function called * importNode but IE, like always doesn't * accept. */ if (typeof newEl == 'undefined'){ var newEl = domDoc.createElement(elmnt.tagName); } if (elmnt.attributes.length &gt; 0){ for (var cont = 0; cont &lt; elmnt.attributes.length; cont++){ if (getBrowser() == 0){ /* * This part of the code it's for the * assholes of MS, what doesn't have * any kind of consideration for * the others, this kind of things * consume resources and * makes more slower the crap of IE. */ if (elmnt.attributes[cont].specified == true){ newEl.setAttribute(elmnt.attributes[cont].nodeName, elmnt.attributes[cont].nodeValue); } }else{ newEl.setAttribute(elmnt.attributes[cont].nodeName, elmnt.attributes[cont].nodeValue); } } } childs = elmnt.childNodes; if (elmnt.childNodes.length &gt; 0){ for (var cont = 0; cont &lt; elmnt.childNodes.length; cont++){ child = elmnt.childNodes[cont]; if (child.nodeType == 1){ newChild = new add2Doc(child, domDoc, domDoc.createElement(child.tagName)); newEl.appendChild(newChild); }else if(child.nodeType == 3){ if (getBrowser() == 1){ newEl.appendChild(domDoc.createTextNode(child.nodeValue)); }else{ if (newEl.tagName == 'STYLE'){ newEl.csstext = child.nodeValue; }else if (newEl.tagName == 'SCRIPT'){ newEl.text = child.nodeValue; } else{ newEl.innerText = child.nodeValue; } } } } } return newEl; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload