html-dom-parser
                                
                                
                                
                                    html-dom-parser copied to clipboard
                            
                            
                            
                        Support `template` tags
The current implementation won't parse <template> tags correctly.
This is because <template> tags use node.content.childNodes instead of node.childNodes for tracking their children.
Related line: https://github.com/remarkablemark/html-dom-parser/blob/master/lib/client/utilities.js#L86
Thanks for opening this issue @loganvolkers. Would you like to open a PR?
I'm working on a rewrite in Typescript for the browser at the moment. Once that project's done might have time to port the logic back.
Sounds good @loganvolkers!
I did a quick check in JSFiddle and it looks like node.childNodes is returning the proper nodes:
const template = document.createElement('template');
template.innerHTML = '<br>';
console.log('template.childNodes', template.childNodes); // invalid
console.log('template.content.childNodes', template.content.childNodes); // valid