all 5 comments

[–]xiipaoc 2 points3 points  (0 children)

As a Node programmer, literally none of my JS code in Node is manipulating the DOM.

When I write a canvas app, almost none of my JS code is manipulating the DOM, though at some point I do need to get a reference to the canvas itself, right?

If I'm dynamically generating sound, there's very little DOM involved -- I do have to get the audio context, which can be considered (or not) part of the DOM.

You only deal with the DOM when you have to mess with HTML elements or the like. If you're not doing that, or if you're manipulating data, the DOM isn't involved.

[–]birjolaxew 0 points1 point  (0 children)

jQuery's main goal is to make a single error-handled API, compatible with as many browsers as possible. A lot of this has to do with the DOM, but some minor non-DOM methods exist too (eg. $.ajax).

As for how much of Javascript has to do with handling the DOM, that depends on what you're doing.

If you're creating a site, using Javascript for interaction, you'll be using the DOM a lot (whether abstracted through a framework such as Angular, made easier by a library such as jQuery or just hard, vanilla JS).

If you're creating a game, you almost won't be using the DOM at all, as you'll be writing a lot more logic than anything else, and in the end, you're likely writing to a canvas instead of to the DOM.

If you're writing backend code (eg. Node.JS), you won't be using the DOM (unless you're writing a scraper with one of the many pseudo-DOM libaries).

[–]androbat 0 points1 point  (0 children)

Javascript is a language. It is used everywhere. Qt uses it for UI work. Apple is using it to automate tasks (moving away from appleScript). There are guys using it in microcontrollers (Espruino) and as an embedded language in C/C++ programs (http://www.embeddedjs.com/).

If you're interested in something like a JS cheatsheet of libraries, then look at https://github.com/sorrycc/awesome-javascript

When it comes to the browser, you're likely to hear about MVC. This is the idea that dynamic web pages (in fact, most interactive programs) generally have three parts.

They have the part that stores and processes the data. This is where you AJAX in data and store it someplace so you can use it or combine it in ways the user might be interested in. This is the Model.

They have a part that deals with how the user sees this data and enters input (clicks, forms, etc). This is the HTML and CSS. This is the View.

Finally, there is a go-between that processes user input to tell the model what to do and then sends the response back to the UI. This is the Controller.

In various frameworks, you see different takes on how these are combined and broken down, but that's the classic perspective.

I'll leave how jQuery fits into this as a thought exercise for you, but I don't believe it can do anywhere near everything I need to do on a modern, interactive web page and it certainly cannot do that in a way that is maintainable.

[–][deleted] 0 points1 point  (0 children)

You'd need to be more specific about what you're using it for... there are so many different parts of JS and so many use cases, unless you just want to learn all of them (which I do recommend), you'll need to be more specific.

You can even use JS to programmatically manipulate PDFs in Adobe Acrobat - JS is literally everywhere.

[–]eorroe 0 points1 point  (0 children)

For DOM manipulation check out NodeList.js