skylarkelty/purity5

Purity5 是一个 HTML5 解析器,具有与 jQuery 相似的接口

1.1.0 2013-08-12 13:13 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:31:28 UTC


README

Purity5 是一个 HTML5 查询库,具有与 jQuery 相似的接口。

使用方法,只需包含 Purity5 并像这样使用

$html = Purity5::parse($markup);
$title = $html("title");
$table_headings = $html("body table tr th");
$first_table_headings = $html("body table tr th:first-child");
$active_links = $html("body a[class=active]");
$active_current_links = $html("body a[class=active+current]");

支持的选择器

  • a > b
  • a + b
  • .a
  • #a
  • a.b
  • a#b
  • .a.b
  • a:first-child
  • a:last-child
  • a:nth-child(num|even|odd)
  • a[attr='val']