I very recently found out that VanillaJS (document?) is a library that's just bundled with 99% browsers and isn't exactly native JavaScript (shock of my life). While writing a lib of my own I normally avoid all helpful things, mostly libs. Now I have three questions:

  1. Is VanillaJS still considered a lib?
  2. Is there a way to do anything with the DOM without VanillaJS?
  3. Are major libs based on VanillaJS or native JS (without the document stuff)
  • 70
    Vanilla JS is a joke. Are you pulling our leg or should I elaborate? – user7043 Oct 28 '14 at 19:37
  • 2
    @RandomUser, I got it the second time I viewed the VanillaJS page. First time, I thought it was a simple helper library that later became "part of JS" when browsers started implementing it's functions. So it did not interest me. – Jesvin Jose Oct 29 '14 at 14:53
  • 1
    @aitchnyu EXACTLY what I thought! No wonder my Wikipedia edits were denied :P – DividedByZero Oct 29 '14 at 16:06
  • 1
    Not to be with the famous vapor js. – Neil Oct 29 '14 at 16:44
  • 1
    @baultista IIRC, when I was referring POJO (Plain Old Java Object), I saw someone joke that it was an etablished pattern, but it needed a cool name to compete with the alternatives. – Jesvin Jose Oct 30 '14 at 8:35

It's a joke, or rather, a witty way to make a point. "vanilla X" refers to "X in the most basic fashion" or "X without anything extra", so "Vanilla JS" is JavaScript as exposed by the browser. VanillaJS is native JavaScript. That includes the DOM, various newfangled APIs, the core language features. It excludes third party code, i.e. what one would normally call libraries or frameworks. The people behind it probably want to point out the advantages of doing things this way by framing it like marketing for a third party framework. There is, or at least used to be, a trend in the JavaScript world to throw frameworks at every problem regardless how trivial a solution in "vanilla" JavaScript would be.

  • 2
    Not quite synonymous with the DOM, but I get your point. Using 'VanillaJS' to manipulate the DOM, one must be aware of all of the different gotchas between the various DOM implementations. If using jQuery to manipulate the DOM, one need only know the abstracted DOM that jQuery exposes. – Andrew Hoffman Oct 28 '14 at 21:03
  • 1
    @AndrewHoffman: The differences between implementations aren't nearly as big as they used to be; now that IE gives a damn about standards, one can easily write cross-browser-compatible code these days. – cHao Oct 29 '14 at 2:41
  • 6
    JavaScript engines (v8, spidermonkey, chakra) do not include the DOM. The DOM is added by the browser environment. – OrangeDog Oct 29 '14 at 10:57
  • 6
    Great joke on this topic: needsmorejquery.com – Almo Oct 29 '14 at 12:38
  • 2
    @RandomUser The DOM api is not part of the language Javascript itself. It is a W3C standard that compliant browsers should implement. For example, see this link where they define what an Element is: w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/… and this link where they define how the DOM should be exposed in Javascript: w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/… – Paul Oct 29 '14 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.