Re: [whatwg/dom] Suggestion: new method - getNodesByType (#992)

> So, when the boilerplate is literally 3 lines of code, how is this proposal worth it, when it'll just create yet another method nobody used or needed to date, and those that did, rightly solved through a TreeWalker?

I can remember 2008.  Then there was no method `getElementsByClassName`.  Chrome was not released until December of that year and support was added to FireFox at version 3 (June 17 2008) and IE9 (March 14 2011).  Before this the method did not commonly exist.  jQuery did not add the Sizzle engine (query selectors) until version 1.3 (January 14 2009) and was not popular until it did.

Before this classes were almost exclusively used for CSS.  Nobody accessed the DOM by class names, because it was too cumbersome and not worth the effort.  Nonetheless it was widely adopted and is widely used.  To solve for this I would have written code almost identical to the original demonstration logic above, but that doesn't mean anybody would use it.  For me writing such logic is trivial, but this may not be true for other developers.

When I search GitHub globally for *getNodesByType* there are more than 6400 JavaScript results and many of the first results look like supplemental means of accessing the DOM by various libraries and utilities in common use.  This demonstrates some level of desire for such a feature.  Since the feature is not a standard this convention may likely also exists under countless other names as well.

Yes it would mean new documentation, implementation guidance, conformance errata, and test cases.  External documentation like MDN and CanIUse would need to be updated as well.  I suspect the greatest level of effort would be in testing for integration with various other related specifications such as SVG, WebGL, WASM, and even various XML technologies like XSLT and XSL-FO.  I suspect the risk from something like this would be very low because it is supplemental and based upon existing conventions.  I am flexible about any implementation, conventions, names, formalities, or approaches.  **My only goal is to request a simplified approach that is a single method requiring a single argument** under any name regardless of any additional specifics.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/992#issuecomment-867107732

Received on Wednesday, 23 June 2021 19:40:38 UTC