Skip to content

Instantly share code, notes, and snippets.

@smallnewer
Last active December 23, 2015 03:59
Show Gist options
  • Save smallnewer/6576720 to your computer and use it in GitHub Desktop.
Save smallnewer/6576720 to your computer and use it in GitHub Desktop.
当对div.innerHTML赋值为某些不符合嵌套规范的标签时,会出现标签丢失的现象。 在做domParse时会出问题。此为问题重现。 解决办法:https://gist.github.com/smallnewer/6577784
var domParser = document.createElement("div");
var html = "<td>123</td>";
// 设置
domParser.innerHTML = html;
//打印
console.log(domParser.innerHTML); // "123",td标签丢失了。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment