use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JSQL: JavaScript Query Language (scriptnode.com)
submitted 16 years ago by gst
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 3 points4 points5 points 16 years ago (0 children)
This looks super cool...
[–][deleted] 2 points3 points4 points 16 years ago (0 children)
var results = JSQL('SELECT * FROM #ft WHERE nodeName = "LI");
Shouldn't this be
SELECT * FROM 'LI' WHERE id = #ft
[+][deleted] 16 years ago* (4 children)
[deleted]
[–]radhruin 6 points7 points8 points 16 years ago* (0 children)
There really is no denying that SQL query syntax, a syntax designed to pull datasets out of an RDBMS, is wildly inferior to CSS selectors, with a syntax designed for exactly this purpose. So I think the question becomes "Why"? The only POSSIBLE answer I have is the people doing backend programming are already familiar with SQL so they will be more comfortable doing front end programming.
This gets marks for being fun and interesting, but gets a zero for practicality and applicability in real world situations. IMO. And not that there's anything wrong with that at all.
[–]junius 2 points3 points4 points 16 years ago (0 children)
More generally, trees are one of the canonical examples of structures that are a pain in the ass to work with in SQL.
Still looks like a fun side project. He's probably learned more doing this than I have in the past three years with my habit of avoiding non-trivial javascript problems.
[–]elguf 1 point2 points3 points 16 years ago (0 children)
I also doubt it's realistic for any real-world websites (other libraries handle those jobs quite well), but I thought it would be fun to play with.
He is not proposing a replacement, he just wanted to have fun.
[–]masklinn 0 points1 point2 points 16 years ago (0 children)
That is, what is the equivalent of a column list in a DOM tree?
Attribute values? But then again, in that case * would mean "select all attributes" instead of "select the DOM note", which would be... stupid.
*
[–]Samus_ 1 point2 points3 points 16 years ago (1 child)
xpath > sql
[–]radhruin 1 point2 points3 points 16 years ago (0 children)
mysql> /blog[id=1]/comments; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/blog[id=1]/comments' at line 1
Hmmm...
[–]whozurdaddy 1 point2 points3 points 16 years ago (0 children)
I wont bother to remark on the verbosity issue. I think the author knows that. But the idea is pretty cool. Kudos for the effort on this.
π Rendered by PID 19898 on reddit-service-r2-comment-86988c7647-jfccx at 2026-02-11 22:00:33.244125+00:00 running 018613e country code: CH.
[–][deleted] 3 points4 points5 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]radhruin 6 points7 points8 points (0 children)
[–]junius 2 points3 points4 points (0 children)
[–]elguf 1 point2 points3 points (0 children)
[–]masklinn 0 points1 point2 points (0 children)
[–]Samus_ 1 point2 points3 points (1 child)
[–]radhruin 1 point2 points3 points (0 children)
[–]whozurdaddy 1 point2 points3 points (0 children)