1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 3× 3× 3× 3× 3× 3× 3× 3× 3× 3× 3× | let tagSoup = false; let selfClose = false; let work = window.document.createElement('div'); try { const html = '<P><I></P></I>'; work.innerHTML = html; tagSoup = work.innerHTML !== html; } catch (e) { tagSoup = false; } try { work.innerHTML = '<P><i><P></P></i></P>'; selfClose = work.childNodes.length === 2; } catch (e) { selfClose = false; } work = null; export { tagSoup, selfClose }; |