Jsdom 5.4.1 發布,JavaScript 的 HTML 解析器

jopen 9年前發布 | 22K 次閱讀 jsdom

jsdom 是 WHATWG DOM 和 HTML 標準的 JavaScript 實現,主要用于 io.js 框架。

 

Jsdom 5.4.1 發布,此版本再次修復了 browserify 上的 Bug。詳細信息請查看更新日志

此版本現已提供下載:

 

示例代碼:

// Count all of the links from the io.js build page
var jsdom = require("jsdom");

jsdom.env(
  "https://iojs.org/dist/",
  ["http://code.jquery.com/jquery.js"],
  function (errors, window) {
    console.log("there have been", window.$("a").length - 4, "io.js releases!");
  }
);

或者:

// Run some jQuery on a html fragment
var jsdom = require("jsdom");

jsdom.env(
  '<p><a class="the-link" ,
  ["http://code.jquery.com/jquery.js"],
  function (errors, window) {
    console.log("contents of a.the-link:", window.$("a.the-link").text());
  }
);
 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!