javascript - Node.innerHTML giving tag names in lower case -


i iterating nodelist node data, while using node.innerhtml getting tag names in lowercase.

actual tags

<panel><label>test</label></panel> 

giving as

<panel><label>test</label></panel> 

i need these tags is. possible regular expression? using dojo (is there way in dojo?).

var xhrargs = {             url: "./user/"+runtime.username+"/ws/workspace/"+workbench.getproject()+"/lib/custom/"+(first.type).replace(".","/")+".html",             content: {},             sync:true,             load: function(data){                 var test = domconstruct.todom(data);                 dojo.foreach(dojo.query("[id]",test),function(node){                     domattr.remove(node,"id");                 });                 var childele = "";                 dojo.foreach(test.childnodes,function(node){                     if(node.innerhtml){                             childele+=node.innerhtml;                     }                 });                 command.add(new modifycommand(newwidget,{},childele,context));             }     }; 

you cannot count on .innerhtml preserving exact nature of original html. in fact, in browsers, it's different (though generates same results) different quotation, case, order of attributes, etc...

it better not rely on preservation of case , adjust javascript deal uncertain case.

it possible use regular expression case insensitive search (the "i" flag designates searches case insensitive), though much, better use direct dom access/searching rather innerhtml searching. you'd have tell more you're trying before offer code.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -