问题
when i tried to get as InnerHTML in Javascript, Firefox giving expected results. so that i can manipulate the dom elements, bu when i use the same working code, IE will strip out the quotation marks from the attribute pair. i am wondering is there any work around to solve this problem. and if possible can any body tell me why does it renders, because of quirks mode or what ? as i have iframes in pages. DocType which i have in my page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expected :
<span id="someID">Ravi <span class="SomeClass">assignment </span>submission</span>
Output
<span id=someID>Ravi <span class=SomeClass>assignment </span>submission</span>
回答1:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
doesn’t trigger quirks mode, it triggers standards mode just fine.
Why do the missing quotes bother you? If you want to manipulate the DOM elements, you don’t need the innerHTML
string.
来源:https://stackoverflow.com/questions/9394318/work-around-for-html-stripping-quotes-in-quirks-mode