Javascript 備忘

parentElement、normalize() 語法相容問題!

1、parentElement

chrome firefox edge ie11
support support support

support

若物件為 TextNode Type 則不支援,建議取parentNode。

 

2、normalize() API

chrome firefox edge ie11
support support support

support

若物為 '創建' 則支持,範列如下:

== ok ==

var div = document.createElement('div');

div.normalize();

== not ok ==

var div = document.getElementByTag('div');

div.normalize();

以上備忘,感謝!