Skip to content

Commit 9d06d52

Browse files
committed
Partially address #1340 with a new Go Further about querySelectorAll
1 parent 87045e7 commit 9d06d52

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

book/scripts.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,20 @@ document = { querySelectorAll: function(s) {
565565
handle. That means you can't use equality to compare `Node`
566566
objects. I'll ignore that but a real browser wouldn't.
567567

568+
::: {.further}
569+
Early browsers didn't offer `querySelectorAll`, only `getElementById`
570+
and `getElementsByTagName`, and the [earliest versions][gEBS] of
571+
`querySelectorAll` were [JavaScript re-implementations][jSelect],
572+
especially in the popular and influential [jQuery
573+
library](https://jquery.org). But since browsers *already* implement
574+
CSS selectors, it [only makes sense][selector-api] to expose that
575+
implementation to JavaScript directly.
576+
:::
577+
578+
[gEBS]: https://simonwillison.net/2003/Mar/25/getElementsBySelector/
579+
[jSelect]: https://johnresig.com/blog/selectors-in-javascript/
580+
[selector-api]: https://www.w3.org/TR/2006/WD-selectors-api-20060525/#introduction
581+
568582
Wrapping Handles
569583
================
570584

0 commit comments

Comments
 (0)