document.head v. document.getElementsByTagName(“head”)[0]

后端 未结 4 2037
遇见更好的自我
遇见更好的自我 2021-02-02 14:56

What is the difference between using document.head and using document.getElementsByTagName(\"head\")[0]? Tests I ran showed that they both take about a

4条回答
  •  孤街浪徒
    2021-02-02 15:49

    According to MDN, document.head only gained support in IE 9, so using the other method as a fallback protects you from browser incompatibilities

提交回复
热议问题