Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

jsdom @ nodeconf 2011

4,598 views

Published on

Published in: Technology
  • Be the first to comment

jsdom @ nodeconf 2011

  1. 1. Why node has a DOM Elijah Insua (tmpvar) @ nodeconf 2011
  2. 2. What is a “DOM”?"The Document Object Model is a platform-and language-neutral interface that will allowprograms and scripts to dynamically accessand update the content, structure and styleof documents."- http://www.w3.org/DOM/
  3. 3. wah wah wah
  4. 4. The browser
  5. 5. Markup
  6. 6. Parser
  7. 7. nodejs.org
  8. 8. Why is this valuable?• No more text manipulation!• An API for manipulating the DOM tree• An extremely common paradigm
  9. 9. Server-sideImplementations
  10. 10. Non-Javascript• PHP (DOMDocument, libxml)• Ruby (Nokogiri)• Java (org.w3c.dom)• Python (xml.dom, xml.minidom)• c/c++ (libxml, gdome)
  11. 11. XML Processing
  12. 12. The xml/html rift• no window• no events• difficult to bootstrap• short lived• no javascript!
  13. 13. markup is good.
  14. 14. Many people know
  15. 15. HTML Represent!• w3c compliant (xml and html)• easy to bootstrap• execute javascript• act like a headless browser (but better) • events / default actions• long living if necessary
  16. 16. What is jsdom?
  17. 17. The w3c DOM, implemented in javascript
  18. 18. What makes it great?
  19. 19. w3c compliance• 100% DOM Level 1 (xml/svg/html)• 100% DOM Level 2 (xml/html/events)• 15% DOM Level 3 (xml)• Passed tests: 2451/3069
  20. 20. Easy to bootstrap jsdom.env
  21. 21. jsdom.env
  22. 22. Projects using jsdom http://search.npmjs.org/#/jsdom
  23. 23. Screen Scraping• Aprocot• node-crawler• wsscraper• scraper• node-moviesearch• spider• jsgrep• query• jjw
  24. 24. Testing• Zombie• Tobie• Ace• Viewjs• Jellyfish (admc/jellyfish)• node-xmpp-bosh
  25. 25. Development• Assetgraph• jspp• inliner• csskeeper• packer• html2jade
  26. 26. Unobtrusive Templating• pure (pure/pure)• weld.js (hij1nx/weld)• minimal.js (ruidlopes/minimal.js)• graft (Shadowfiend/graft)
  27. 27. Code Reuse• YUI3• node-flot• node-highcharts• node-readability• node-rapheal
  28. 28. Shout outs• Adrian Makowski • Evan Jones • Matthew Pflueger • Vincent Desjardins• Alexander Flatter • Felix Gnass • Michael Fleet • Vytautas Jakutis• Andreas Lind Petersen • Gord Tanner • Nick Stenning • Wei Dai• Aria Stewart • Jerry Sievert • Nicolas LaCasse • Yonathan• Arrix • Jos Shepherd • Olivier El Mekki • hij1nx• Avery Fay • Joshua Peek • Phil Dokas • indexzero• Damian Janowski • José Valim • Rodrigo Flores • isaacs• Daniel Cassidy • Julien Guimont • Ryan Wolf • steve• Daniël van de Burgt • Karuna Sagar • Sam Ruby • ulteriorlife• Dav Glass • Karuna Sagar K • Shimon Doodkin • waslogic• Edward OConnor • Marak Squires • Swizec Teller• Evan Haas • Matthew King • Tom Taylor
  29. 29. TODO• default actions for elements• speed improvements• fix memory leak• better window implementation + testing
  30. 30. Thank you!https://github.com/tmpvar/jsdom

×