代码之家  ›  专栏  ›  技术社区  ›  Gary

将用户提供的内容插入文档——验证HTML字符串、insertAdjacentHTML和iframe的使用情况?

  •  0
  • Gary  · 技术社区  · 6 年前

    例如,如果用户使用MathML提供数学表达式,并且这些表达式将显示在当前网页中,则用户可以添加一个 <div> <p>

    insertAdjacentHTML article 这似乎暗示了这一点, "It does not reparse the element it is being used on, and thus it does not corrupt the existing elements inside that element."

    或者,是否有方法在插入DOM之前验证HTML字符串,例如 DOMParser

    0 回复  |  直到 6 年前