taoqf / node-html-parser

A very fast HTML parser, generating a simplified DOM, with basic element query support.
MIT License
1.12k stars 112 forks source link

add getElementsByTagName to HTMLElement (FR) #155

Closed steve-py96 closed 3 years ago

steve-py96 commented 3 years ago

I have a case where I have more than 300k rows of a database (in HTML format ofc) and would like to get the tr-elements.
Using querySelectorAll results in an endless loading loop (or at least a waiting span of more than 30min which was waited for :D). I tried injecting a plain getElementsByTagName which checks if selector === rawTagName and it worked out, therefore this feature request to get that one added (I'd try to contribute if you want me to :P)

nonara commented 3 years ago

Thanks for the suggestion @steve-py96! Certainly, using a query selector will have more overhead than a simple iterator.

If your feature conforms to the MDN behaviour for getElementsByTagName and you'd like to submit a PR, I'd be happy to review it!