• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<html><head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
3<meta charset="utf-8">
4<meta http-equiv="X-UA-Compatible" content="IE=edge">
5<title>inikulin/parse5</title>
6<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
7<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
8<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png">
9<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png">
10<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png">
11<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png">
12<meta property="fb:app_id" content="1401488693436528">
13<meta content="@github" name="twitter:site"><meta content="summary" name="twitter:card"><meta content="inikulin/parse5" name="twitter:title"><meta content="parse5 - Fast full-featured HTML parser for Node. Based on WHATWG HTML5 specification." name="twitter:description"><meta content="https://0.gravatar.com/avatar/64ee497c4a533144a9bf9ce2a6c010c5?d=https%3A%2F%2Fidenticons.github.com%2F9dd4dc5634e3d3d97c7d5a34ba28b850.png&amp;r=x&amp;s=400" name="twitter:image:src">
14<meta content="GitHub" property="og:site_name"><meta content="object" property="og:type"><meta content="https://0.gravatar.com/avatar/64ee497c4a533144a9bf9ce2a6c010c5?d=https%3A%2F%2Fidenticons.github.com%2F9dd4dc5634e3d3d97c7d5a34ba28b850.png&amp;r=x&amp;s=400" property="og:image"><meta content="inikulin/parse5" property="og:title"><meta content="https://github.com/inikulin/parse5" property="og:url"><meta content="parse5 - Fast full-featured HTML parser for Node. Based on WHATWG HTML5 specification." property="og:description">
15
16<meta name="hostname" content="github-fe139-cp1-prd.iad.github.net">
17<meta name="ruby" content="ruby 2.1.0p0-github-tcmalloc (60139581e1) [x86_64-linux]">
18<link rel="assets" href="https://github.global.ssl.fastly.net/">
19<link rel="conduit-xhr" href="https://ghconduit.com:25035/">
20<link rel="xhr-socket" href="/_sockets">
21
22
23
24<meta name="msapplication-TileImage" content="/windows-tile.png">
25<meta name="msapplication-TileColor" content="#ffffff">
26<meta name="selected-link" value="repo_source" data-pjax-transient="">
27<meta content="collector.githubapp.com" name="octolytics-host"><meta content="collector-cdn.github.com" name="octolytics-script-host"><meta content="github" name="octolytics-app-id"><meta content="BC802450:77B8:1BEFBBB:52E7B0AD" name="octolytics-dimension-request_id"><meta content="453071" name="octolytics-actor-id"><meta content="inikulin" name="octolytics-actor-login"><meta content="dcd292e4f5a14fcca9047ec5928186bef2925b78f574ae89c6be99c099695093" name="octolytics-actor-hash">
28
29
30
31
32<link rel="icon" type="image/x-icon" href="/favicon.ico">
33
34<meta content="authenticity_token" name="csrf-param">
35<meta content="QCjdZSQ/aWGKiOknksU3UAanpjr415E/Uf5HPq07DzE=" name="csrf-token">
36
37<link href="https://github.global.ssl.fastly.net/assets/github-894b05c38c2dcc924115c5a685b514f0ed11ecbe.css" media="all" rel="stylesheet" type="text/css">
38<link href="https://github.global.ssl.fastly.net/assets/github2-10f7b6999ba0543eaa86b9fe582445f0ee747741.css" media="all" rel="stylesheet" type="text/css">
39
40
41
42<script src="https://github.global.ssl.fastly.net/assets/frameworks-2086b76396d7018acf390457357b14121f3e16f3.js" type="text/javascript"></script>
43<script async="async" defer="defer" src="https://github.global.ssl.fastly.net/assets/github-4f3fea02ac13c7f75f0e8530e0996e90c6e78194.js" type="text/javascript"></script>
44
45<meta http-equiv="x-pjax-version" content="c360d73a08ef99ad12374a4c17689461">
46
47
48<meta name="description" content="parse5 - Fast full-featured HTML parser for Node. Based on WHATWG HTML5 specification.">
49
50<meta content="453071" name="octolytics-dimension-user_id"><meta content="inikulin" name="octolytics-dimension-user_login"><meta content="8862593" name="octolytics-dimension-repository_id"><meta content="inikulin/parse5" name="octolytics-dimension-repository_nwo"><meta content="true" name="octolytics-dimension-repository_public"><meta content="false" name="octolytics-dimension-repository_is_fork"><meta content="8862593" name="octolytics-dimension-repository_network_root_id"><meta content="inikulin/parse5" name="octolytics-dimension-repository_network_root_nwo">
51<link href="https://github.com/inikulin/parse5/commits/master.atom" rel="alternate" title="Recent Commits to parse5:master" type="application/atom+xml">
52
53</head>
54
55
56<body class="logged_in  env-production windows vis-public">
57<div class="wrapper">
58
59
60
61
62
63
64<div class="header header-logged-in true">
65<div class="container clearfix">
66
67<a class="header-logo-invertocat" href="https://github.com/">
68<span class="mega-octicon octicon-mark-github"></span>
69</a>
70
71
72<a href="/notifications" class="notification-indicator tooltipped downwards" data-gotokey="n" title="You have no unread notifications">
73<span class="mail-status all-read"></span>
74</a>
75
76<div class="command-bar js-command-bar  in-repository">
77<form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
78
79<input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off" data-username="inikulin" data-repo="inikulin/parse5" data-branch="master" data-sha="805df99e28e1373996c56faa90a96fa366e1fc12">
80
81<input type="hidden" name="nwo" value="inikulin/parse5">
82
83<div class="select-menu js-menu-container js-select-menu search-context-select-menu">
84<span class="minibutton select-menu-button js-menu-target">
85<span class="js-select-button">This repository</span>
86</span>
87
88<div class="select-menu-modal-holder js-menu-content js-navigation-container">
89<div class="select-menu-modal">
90
91<div class="select-menu-item js-navigation-item js-this-repository-navigation-item selected">
92<span class="select-menu-item-icon octicon octicon-check"></span>
93<input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked">
94<div class="select-menu-item-text js-select-button-text">This repository</div>
95</div> <!-- /.select-menu-item -->
96
97<div class="select-menu-item js-navigation-item js-all-repositories-navigation-item">
98<span class="select-menu-item-icon octicon octicon-check"></span>
99<input type="radio" name="search_target" value="global">
100<div class="select-menu-item-text js-select-button-text">All repositories</div>
101</div> <!-- /.select-menu-item -->
102
103</div>
104</div>
105</div>
106
107<span class="octicon help tooltipped downwards" title="Show command bar help">
108<span class="octicon octicon-question"></span>
109</span>
110
111
112<input type="hidden" name="ref" value="cmdform">
113
114</form>
115<ul class="top-nav">
116<li class="explore"><a href="/explore">Explore</a></li>
117<li><a href="https://gist.github.com">Gist</a></li>
118<li><a href="/blog">Blog</a></li>
119<li><a href="https://help.github.com">Help</a></li>
120</ul>
121</div>
122
123
124
125
126<ul id="user-links">
127<li>
128<a href="/inikulin" class="name">
129<img alt="Ivan Nikulin" height="20" src="https://2.gravatar.com/avatar/64ee497c4a533144a9bf9ce2a6c010c5?d=https%3A%2F%2Fidenticons.github.com%2F9dd4dc5634e3d3d97c7d5a34ba28b850.png&amp;r=x&amp;s=140" width="20"> inikulin
130</a>
131</li>
132
133<li class="new-menu dropdown-toggle js-menu-container">
134<a href="#" class="js-menu-target tooltipped downwards" title="Create new..." aria-label="Create new...">
135<span class="octicon octicon-plus"></span>
136<span class="dropdown-arrow"></span>
137</a>
138
139<div class="js-menu-content">
140</div>
141</li>
142
143<li>
144<a href="/settings/profile" id="account_settings" class="tooltipped downwards" aria-label="Account settings " title="Account settings ">
145<span class="octicon octicon-tools"></span>
146</a>
147</li>
148<li>
149<a class="tooltipped downwards" href="/logout" data-method="post" id="logout" title="Sign out" aria-label="Sign out">
150<span class="octicon octicon-log-out"></span>
151</a>
152</li>
153
154</ul>
155
156<div class="js-new-dropdown-contents hidden">
157
158
159<ul class="dropdown-menu">
160<li>
161<a href="/new"><span class="octicon octicon-repo-create"></span> New repository</a>
162</li>
163<li>
164<a href="/organizations/new"><span class="octicon octicon-organization"></span> New organization</a>
165</li>
166
167
168
169<li class="section-title">
170<span title="inikulin/parse5">This repository</span>
171</li>
172<li>
173<a href="/inikulin/parse5/issues/new"><span class="octicon octicon-issue-opened"></span> New issue</a>
174</li>
175<li>
176<a href="/inikulin/parse5/settings/collaboration"><span class="octicon octicon-person-add"></span> New collaborator</a>
177</li>
178</ul>
179
180</div>
181
182
183
184</div>
185</div>
186
187
188
189
190
191
192
193
194<div class="site" itemscope="" itemtype="http://schema.org/WebPage">
195
196<div class="pagehead repohead instapaper_ignore readability-menu">
197<div class="container">
198
199
200<ul class="pagehead-actions">
201
202<li class="subscription">
203<form accept-charset="UTF-8" action="/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="QCjdZSQ/aWGKiOknksU3UAanpjr415E/Uf5HPq07DzE="></div>  <input id="repository_id" name="repository_id" type="hidden" value="8862593">
204
205<div class="select-menu js-menu-container js-select-menu">
206<a class="social-count js-social-count" href="/inikulin/parse5/watchers">
20722
208</a>
209<span class="minibutton select-menu-button with-count js-menu-target" role="button" tabindex="0">
210<span class="js-select-button">
211<span class="octicon octicon-eye-unwatch"></span>
212Unwatch
213</span>
214</span>
215
216<div class="select-menu-modal-holder">
217<div class="select-menu-modal subscription-menu-modal js-menu-content">
218<div class="select-menu-header">
219<span class="select-menu-title">Notification status</span>
220<span class="octicon octicon-remove-close js-menu-close"></span>
221</div> <!-- /.select-menu-header -->
222
223<div class="select-menu-list js-navigation-container" role="menu">
224
225<div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
226<span class="select-menu-item-icon octicon octicon-check"></span>
227<div class="select-menu-item-text">
228<input id="do_included" name="do" type="radio" value="included">
229<h4>Not watching</h4>
230<span class="description">You only receive notifications for conversations in which you participate or are @mentioned.</span>
231<span class="js-select-button-text hidden-select-button-text">
232<span class="octicon octicon-eye-watch"></span>
233Watch
234</span>
235</div>
236</div> <!-- /.select-menu-item -->
237
238<div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0">
239<span class="select-menu-item-icon octicon octicon octicon-check"></span>
240<div class="select-menu-item-text">
241<input checked="checked" id="do_subscribed" name="do" type="radio" value="subscribed">
242<h4>Watching</h4>
243<span class="description">You receive notifications for all conversations in this repository.</span>
244<span class="js-select-button-text hidden-select-button-text">
245<span class="octicon octicon-eye-unwatch"></span>
246Unwatch
247</span>
248</div>
249</div> <!-- /.select-menu-item -->
250
251<div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
252<span class="select-menu-item-icon octicon octicon-check"></span>
253<div class="select-menu-item-text">
254<input id="do_ignore" name="do" type="radio" value="ignore">
255<h4>Ignoring</h4>
256<span class="description">You do not receive any notifications for conversations in this repository.</span>
257<span class="js-select-button-text hidden-select-button-text">
258<span class="octicon octicon-mute"></span>
259Stop ignoring
260</span>
261</div>
262</div> <!-- /.select-menu-item -->
263
264</div> <!-- /.select-menu-list -->
265
266</div> <!-- /.select-menu-modal -->
267</div> <!-- /.select-menu-modal-holder -->
268</div> <!-- /.select-menu -->
269
270</form>
271</li>
272
273<li>
274
275
276<div class="js-toggler-container js-social-container starring-container on">
277<a href="/inikulin/parse5/unstar" class="minibutton with-count js-toggler-target star-button starred upwards" title="Unstar this repository" data-remote="true" data-method="post" rel="nofollow">
278<span class="octicon octicon-star-delete"></span><span class="text">Unstar</span>
279</a>
280
281<a href="/inikulin/parse5/star" class="minibutton with-count js-toggler-target star-button unstarred upwards" title="Star this repository" data-remote="true" data-method="post" rel="nofollow">
282<span class="octicon octicon-star"></span><span class="text">Star</span>
283</a>
284
285<a class="social-count js-social-count" href="/inikulin/parse5/stargazers">
286406
287</a>
288</div>
289
290</li>
291
292
293<li>
294<a href="/inikulin/parse5/fork" class="minibutton with-count js-toggler-target fork-button lighter upwards" title="Fork this repo" rel="facebox nofollow">
295<span class="octicon octicon-git-branch-create"></span><span class="text">Fork</span>
296</a>
297<a href="/inikulin/parse5/network" class="social-count">14</a>
298</li>
299
300
301</ul>
302
303<h1 itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
304<span class="repo-label"><span>public</span></span>
305<span class="mega-octicon octicon-repo"></span>
306<span class="author">
307<a href="/inikulin" class="url fn" itemprop="url" rel="author"><span itemprop="title">inikulin</span></a>
308</span>
309<span class="repohead-name-divider">/</span>
310<strong><a href="/inikulin/parse5" class="js-current-repository js-repo-home-link">parse5</a></strong>
311
312<span class="page-context-loader">
313<img alt="Octocat-spinner-32" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
314</span>
315
316</h1>
317</div><!-- /.container -->
318</div><!-- /.repohead -->
319
320<div class="container">
321
322
323<div class="repository-with-sidebar repo-container with-full-navigation ">
324
325<div class="repository-sidebar">
326
327
328<div class="sunken-menu vertical-right repo-nav js-repo-nav js-repository-container-pjax js-octicon-loaders">
329<div class="sunken-menu-contents">
330<ul class="sunken-menu-group">
331<li class="tooltipped leftwards" title="Code">
332<a href="/inikulin/parse5" aria-label="Code" class="selected js-selected-navigation-item sunken-menu-item" data-gotokey="c" data-pjax="true" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /inikulin/parse5">
333<span class="octicon octicon-code"></span> <span class="full-word">Code</span>
334<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
335</a>      </li>
336
337<li class="tooltipped leftwards" title="Issues">
338<a href="/inikulin/parse5/issues" aria-label="Issues" class="js-selected-navigation-item sunken-menu-item js-disable-pjax" data-gotokey="i" data-selected-links="repo_issues /inikulin/parse5/issues">
339<span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>
340<span class="counter">0</span>
341<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
342</a>        </li>
343
344<li class="tooltipped leftwards" title="Pull Requests">
345<a href="/inikulin/parse5/pulls" aria-label="Pull Requests" class="js-selected-navigation-item sunken-menu-item js-disable-pjax" data-gotokey="p" data-selected-links="repo_pulls /inikulin/parse5/pulls">
346<span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull Requests</span>
347<span class="counter">0</span>
348<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
349</a>      </li>
350
351
352<li class="tooltipped leftwards" title="Wiki">
353<a href="/inikulin/parse5/wiki" aria-label="Wiki" class="js-selected-navigation-item sunken-menu-item" data-pjax="true" data-selected-links="repo_wiki /inikulin/parse5/wiki">
354<span class="octicon octicon-book"></span> <span class="full-word">Wiki</span>
355<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
356</a>        </li>
357</ul>
358<div class="sunken-menu-separator"></div>
359<ul class="sunken-menu-group">
360
361<li class="tooltipped leftwards" title="Pulse">
362<a href="/inikulin/parse5/pulse" aria-label="Pulse" class="js-selected-navigation-item sunken-menu-item" data-pjax="true" data-selected-links="pulse /inikulin/parse5/pulse">
363<span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>
364<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
365</a>      </li>
366
367<li class="tooltipped leftwards" title="Graphs">
368<a href="/inikulin/parse5/graphs" aria-label="Graphs" class="js-selected-navigation-item sunken-menu-item" data-pjax="true" data-selected-links="repo_graphs repo_contributors /inikulin/parse5/graphs">
369<span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>
370<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
371</a>      </li>
372
373<li class="tooltipped leftwards" title="Network">
374<a href="/inikulin/parse5/network" aria-label="Network" class="js-selected-navigation-item sunken-menu-item js-disable-pjax" data-selected-links="repo_network /inikulin/parse5/network">
375<span class="octicon octicon-git-branch"></span> <span class="full-word">Network</span>
376<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
377</a>      </li>
378</ul>
379
380
381<div class="sunken-menu-separator"></div>
382<ul class="sunken-menu-group">
383<li class="tooltipped leftwards" title="Settings">
384<a href="/inikulin/parse5/settings" class="sunken-menu-item" data-pjax="" aria-label="Settings">
385<span class="octicon octicon-tools"></span> <span class="full-word">Settings</span>
386<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
387</a>
388</li>
389</ul>
390</div>
391</div>
392
393<div class="only-with-full-nav">
394
395
396
397
398<div class="clone-url " data-protocol-type="http" data-url="/users/set_protocol?protocol_selector=http&amp;protocol_type=push">
399<h3><strong>HTTPS</strong> clone URL</h3>
400<div class="clone-url-box">
401<input type="text" class="clone js-url-field" value="https://github.com/inikulin/parse5.git" readonly="readonly">
402
403<span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/inikulin/parse5.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
404</div>
405</div>
406
407
408
409<div class="clone-url " data-protocol-type="ssh" data-url="/users/set_protocol?protocol_selector=ssh&amp;protocol_type=push">
410<h3><strong>SSH</strong> clone URL</h3>
411<div class="clone-url-box">
412<input type="text" class="clone js-url-field" value="git@github.com:inikulin/parse5.git" readonly="readonly">
413
414<span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="git@github.com:inikulin/parse5.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
415</div>
416</div>
417
418
419
420<div class="clone-url open" data-protocol-type="subversion" data-url="/users/set_protocol?protocol_selector=subversion&amp;protocol_type=push">
421<h3><strong>Subversion</strong> checkout URL</h3>
422<div class="clone-url-box">
423<input type="text" class="clone js-url-field" value="https://github.com/inikulin/parse5" readonly="readonly">
424
425<span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/inikulin/parse5" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
426</div>
427</div>
428
429
430<p class="clone-options">You can clone with
431<a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a>,
432<a href="#" class="js-clone-selector" data-protocol="ssh">SSH</a>,
433or <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>.
434<span class="octicon help tooltipped upwards" title="Get help on which URL is right for you.">
435<a href="https://help.github.com/articles/which-remote-url-should-i-use">
436<span class="octicon octicon-question"></span>
437</a>
438</span>
439</p>
440
441
442<a href="http://windows.github.com" class="minibutton sidebar-button">
443<span class="octicon octicon-device-desktop"></span>
444Clone in Desktop
445</a>
446
447<a href="/inikulin/parse5/archive/master.zip" class="minibutton sidebar-button" title="Download this repository as a zip file" rel="nofollow">
448<span class="octicon octicon-cloud-download"></span>
449Download ZIP
450</a>
451</div>
452</div><!-- /.repository-sidebar -->
453
454<div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container="">
455
456
457<span id="js-show-full-navigation"></span>
458
459<div class="repository-meta js-details-container ">
460<div class="repository-description js-details-show">
461<p>Fast full-featured HTML parser for Node. Based on WHATWG HTML5 specification.</p>
462</div>
463
464
465<span class="edit-link js-details-show js-details-target">— <a href="#">Edit</a></span>
466<form accept-charset="UTF-8" action="/inikulin/parse5/settings/update_meta" class="edit-repository-meta js-details-edit" method="post"><div style="margin:0;padding:0;display:inline"><input name="_method" type="hidden" value="put"><input name="authenticity_token" type="hidden" value="QCjdZSQ/aWGKiOknksU3UAanpjr415E/Uf5HPq07DzE="></div>
467
468<div class="field description-field">
469<label for="repo_description">Description</label>
470<input type="text" name="repo_description" value="Fast full-featured HTML parser for Node. Based on WHATWG HTML5 specification." placeholder="Short description of this repository">
471</div>
472
473<div class="field website-field">
474<label for="repo_homepage">Website</label>
475<input type="text" name="repo_homepage" value="" placeholder="Website for this repository (optional)">
476</div>
477
478<button class="button classy">Save</button>
479<span class="cancel">or <a href="#" class="js-details-target">cancel</a></span>
480</form>
481</div>
482
483<div class="capped-box overall-summary ">
484
485<div class="stats-switcher-viewport js-stats-switcher-viewport">
486
487<ul class="numbers-summary">
488<li class="commits">
489<a data-pjax="" href="/inikulin/parse5/commits/master">
490<span class="num">
491<span class="octicon octicon-history"></span>
492149
493</span>
494commits
495</a>
496</li>
497<li>
498<a data-pjax="" href="/inikulin/parse5/branches">
499<span class="num">
500<span class="octicon octicon-git-branch"></span>
5011
502</span>
503branch
504</a>
505</li>
506
507<li>
508<a data-pjax="" href="/inikulin/parse5/releases">
509<span class="num">
510<span class="octicon octicon-tag"></span>
5112
512</span>
513releases
514</a>
515</li>
516
517<li>
518
519<a href="/inikulin/parse5/graphs/contributors">
520<span class="num">
521<span class="octicon octicon-organization"></span>
5222
523</span>
524contributors
525</a>
526</li>
527</ul>
528
529<div class="repository-lang-stats">
530<ol class="repository-lang-stats-numbers">
531<li>
532<a href="/inikulin/parse5/search?l=javascript">
533<span class="color-block language-color" style="background-color:#f15501;"></span>
534<span class="lang">JavaScript</span>
535<span class="percent">100%</span>
536</a>
537</li>
538</ol>
539</div>
540</div>
541
542</div>
543
544<a href="#" class="repository-lang-stats-graph js-toggle-lang-stats tooltipped downwards" title="Show language statistics" style="background-color:#f15501">
545<span class="language-color" style="width:100%; background-color:#f15501;" itemprop="keywords">JavaScript</span>
546</a>
547
548
549<div>
550</div>
551
552
553<div class="file-navigation in-mid-page">
554<a href="/inikulin/parse5/compare" aria-label="Compare, review, create a pull request" class="minibutton compact primary tooltipped downwards" title="Compare &amp; review" data-pjax="">
555<span class="octicon octicon-git-compare"></span>
556</a>
557
558
559
560<div class="select-menu js-menu-container js-select-menu">
561<span class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-master-branch="master" data-ref="master" role="button" aria-label="Switch branches or tags" tabindex="0">
562<span class="octicon octicon-git-branch"></span>
563<i>branch:</i>
564<span class="js-select-button">master</span>
565</span>
566
567<div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax="">
568
569<div class="select-menu-modal">
570<div class="select-menu-header">
571<span class="select-menu-title">Switch branches/tags</span>
572<span class="octicon octicon-remove-close js-menu-close"></span>
573</div> <!-- /.select-menu-header -->
574
575<div class="select-menu-filters">
576<div class="select-menu-text-filter">
577<input type="text" aria-label="Find or create a branch…" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Find or create a branch…">
578</div>
579<div class="select-menu-tabs">
580<ul>
581<li class="select-menu-tab">
582<a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
583</li>
584<li class="select-menu-tab">
585<a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
586</li>
587</ul>
588</div><!-- /.select-menu-tabs -->
589</div><!-- /.select-menu-filters -->
590
591<div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">
592
593<div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
594
595
596<div class="select-menu-item js-navigation-item selected">
597<span class="select-menu-item-icon octicon octicon-check"></span>
598<a href="/inikulin/parse5/tree/master" data-name="master" data-skip-pjax="true" rel="nofollow" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" title="master">master</a>
599</div> <!-- /.select-menu-item -->
600</div>
601
602<form accept-charset="UTF-8" action="/inikulin/parse5/branches" class="js-create-branch select-menu-item select-menu-new-item-form js-navigation-item js-new-item-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="QCjdZSQ/aWGKiOknksU3UAanpjr415E/Uf5HPq07DzE="></div>
603<span class="octicon octicon-git-branch-create select-menu-item-icon"></span>
604<div class="select-menu-item-text">
605<h4>Create branch: <span class="js-new-item-name"></span></h4>
606<span class="description">from ‘master’</span>
607</div>
608<input type="hidden" name="name" id="name" class="js-new-item-value">
609<input type="hidden" name="branch" id="branch" value="master">
610<input type="hidden" name="path" id="path" value="">
611</form> <!-- /.select-menu-item -->
612
613</div> <!-- /.select-menu-list -->
614
615<div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
616<div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
617
618
619<div class="select-menu-item js-navigation-item ">
620<span class="select-menu-item-icon octicon octicon-check"></span>
621<a href="/inikulin/parse5/tree/v0.6.0" data-name="v0.6.0" data-skip-pjax="true" rel="nofollow" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" title="v0.6.0">v0.6.0</a>
622</div> <!-- /.select-menu-item -->
623<div class="select-menu-item js-navigation-item ">
624<span class="select-menu-item-icon octicon octicon-check"></span>
625<a href="/inikulin/parse5/tree/0.6.1" data-name="0.6.1" data-skip-pjax="true" rel="nofollow" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" title="0.6.1">0.6.1</a>
626</div> <!-- /.select-menu-item -->
627</div>
628
629<div class="select-menu-no-results">Nothing to show</div>
630</div> <!-- /.select-menu-list -->
631
632</div> <!-- /.select-menu-modal -->
633</div> <!-- /.select-menu-modal-holder -->
634</div> <!-- /.select-menu -->
635
636
637<div class="breadcrumb"><span class="repo-root js-repo-root"><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/inikulin/parse5" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">parse5</span></a></span></span><span class="separator"> / </span><form action="/inikulin/parse5/new/master" class="js-new-blob-form tooltipped rightwards new-file-link" method="post" title="Create a new file here"><span aria-label="Create a new file here" class="js-new-blob-submit octicon octicon-file-add" data-test-id="create-new-git-file" role="button"></span></form></div>
638</div>
639
640
641
642<a href="/inikulin/parse5/find/master" data-hotkey="t" class="js-show-file-finder" style="display:none" data-pjax="">Show File Finder</a>
643<div class="bubble files-bubble">
644
645
646<div class="commit commit-tease js-details-container">
647<p class="commit-title ">
648<a href="/inikulin/parse5/commit/33972193530003cbaf24c3cdde4ab2d3c94ede67" class="message" data-pjax="true" title="htmlparser2 tree adapter tested">htmlparser2 tree adapter tested</a>
649
650</p>
651<div class="commit-meta">
652<span class="js-zeroclipboard zeroclipboard-link" data-clipboard-text="33972193530003cbaf24c3cdde4ab2d3c94ede67" data-copied-hint="copied!" title="Copy SHA"><span class="octicon octicon-clippy"></span></span>
653<a href="/inikulin/parse5/commit/33972193530003cbaf24c3cdde4ab2d3c94ede67" class="sha-block" data-pjax="">latest commit <span class="sha">3397219353</span></a>
654
655<div class="authorship">
656<img alt="Ivan Nikulin" class="gravatar" height="20" src="https://2.gravatar.com/avatar/64ee497c4a533144a9bf9ce2a6c010c5?d=https%3A%2F%2Fidenticons.github.com%2F9dd4dc5634e3d3d97c7d5a34ba28b850.png&amp;r=x&amp;s=140" width="20">
657<span class="author-name"><a href="/inikulin" data-skip-pjax="true" rel="author">inikulin</a></span>
658authored <time class="js-relative-date updated" datetime="2014-01-27T02:02:50-08:00" title="2014-01-27 02:02:50">January 27, 2014</time>
659
660</div>
661</div>
662</div>
663
664<table class="files" data-pjax="">
665
666
667<tbody class="" data-url="/inikulin/parse5/file-list/master">
668<tr>
669<td class="icon">
670<span class="octicon octicon-file-directory"></span>
671<img alt="Octocat-spinner-32" class="spinner" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
672</td>
673<td class="content">
674<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/tree/master/lib" class="js-directory-link" id="e8acc63b1e238f3255c900eed37254b8-9c0e11982fee8ec9905328a0f1255880895ebce8" title="lib">lib</a></span>
675</td>
676<td class="message">
677<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/commit/33972193530003cbaf24c3cdde4ab2d3c94ede67" class="message" data-pjax="true" title="htmlparser2 tree adapter tested">htmlparser2 tree adapter tested</a></span>
678</td>
679<td class="age"><span class="css-truncate css-truncate-target"><time class="js-relative-date" datetime="2014-01-27T02:02:50-08:00" title="2014-01-27 02:02:50">January 27, 2014</time></span></td>
680</tr>
681<tr>
682<td class="icon">
683<span class="octicon octicon-file-directory"></span>
684<img alt="Octocat-spinner-32" class="spinner" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
685</td>
686<td class="content">
687<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/tree/master/test" class="js-directory-link" id="098f6bcd4621d373cade4e832627b4f6-e8d4326833c08a6731851e4f79dc8b3a172ed1fc" title="test">test</a></span>
688</td>
689<td class="message">
690<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/commit/33972193530003cbaf24c3cdde4ab2d3c94ede67" class="message" data-pjax="true" title="htmlparser2 tree adapter tested">htmlparser2 tree adapter tested</a></span>
691</td>
692<td class="age"><span class="css-truncate css-truncate-target"><time class="js-relative-date" datetime="2014-01-27T02:02:50-08:00" title="2014-01-27 02:02:50">January 27, 2014</time></span></td>
693</tr>
694<tr>
695<td class="icon">
696<span class="octicon octicon-file-text"></span>
697<img alt="Octocat-spinner-32" class="spinner" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
698</td>
699<td class="content">
700<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/blob/master/.gitignore" class="js-directory-link" id="a084b794bc0759e7a6b77810e01874f2-00943223614db1f9c2386227950a3d84120819f4" title=".gitignore">.gitignore</a></span>
701</td>
702<td class="message">
703<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/commit/33c5522146f1b48054259848cf711aebbe133337" class="message" data-pjax="true" title="Merge">Merge</a></span>
704</td>
705<td class="age"><span class="css-truncate css-truncate-target"><time class="js-relative-date" datetime="2013-07-15T09:33:17-07:00" title="2013-07-15 09:33:17">July 15, 2013</time></span></td>
706</tr>
707<tr>
708<td class="icon">
709<span class="octicon octicon-file-text"></span>
710<img alt="Octocat-spinner-32" class="spinner" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
711</td>
712<td class="content">
713<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/blob/master/LICENSE" class="js-directory-link" id="9879d6db96fd29134fc802214163b95a-6c630a0871e8239761813ac074c17882060b73a6" title="LICENSE">LICENSE</a></span>
714</td>
715<td class="message">
716<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/commit/33c5522146f1b48054259848cf711aebbe133337" class="message" data-pjax="true" title="Merge">Merge</a></span>
717</td>
718<td class="age"><span class="css-truncate css-truncate-target"><time class="js-relative-date" datetime="2013-07-15T09:33:17-07:00" title="2013-07-15 09:33:17">July 15, 2013</time></span></td>
719</tr>
720<tr>
721<td class="icon">
722<span class="octicon octicon-file-text"></span>
723<img alt="Octocat-spinner-32" class="spinner" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
724</td>
725<td class="content">
726<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/blob/master/README.md" class="js-directory-link" id="04c6e90faac2675aa89e2176d2eec7d8-414202e1799908d7727efbcbb9fe2e58ef42d114" title="README.md">README.md</a></span>
727</td>
728<td class="message">
729<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/commit/6c541498d323cc6130d098f242ebc10132ad1eaa" class="message" data-pjax="true" title="Add a Bitdeli badge to README">Add a Bitdeli badge to README</a></span>
730</td>
731<td class="age"><span class="css-truncate css-truncate-target"><time class="js-relative-date" datetime="2013-12-10T07:33:31-08:00" title="2013-12-10 07:33:31">December 10, 2013</time></span></td>
732</tr>
733<tr>
734<td class="icon">
735<span class="octicon octicon-file-text"></span>
736<img alt="Octocat-spinner-32" class="spinner" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
737</td>
738<td class="content">
739<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/blob/master/index.js" class="js-directory-link" id="168726dbe96b3ce427e7fedce31bb0bc-423b9a1511e0e8d8e43434febcbccca62671df19" title="index.js">index.js</a></span>
740</td>
741<td class="message">
742<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/commit/e7af4374108276796a9991d49278429eb33293ab" class="message" data-pjax="true" title="Implementation of the htmlparser2 tree support started">Implementation of the htmlparser2 tree support started</a></span>
743</td>
744<td class="age"><span class="css-truncate css-truncate-target"><time class="js-relative-date" datetime="2014-01-24T04:11:52-08:00" title="2014-01-24 04:11:52">January 24, 2014</time></span></td>
745</tr>
746<tr>
747<td class="icon">
748<span class="octicon octicon-file-text"></span>
749<img alt="Octocat-spinner-32" class="spinner" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16">
750</td>
751<td class="content">
752<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/blob/master/package.json" class="js-directory-link" id="b9cfc7f2cdf78a7f4b91a753d10865a2-99397a1dd31332b9a64d9af9cf32b7340a600f92" title="package.json">package.json</a></span>
753</td>
754<td class="message">
755<span class="css-truncate css-truncate-target"><a href="/inikulin/parse5/commit/b8d56257897357e655a71ba21d4bd40e12b33230" class="message" data-pjax="true" title="Expose Tokenizer">Expose Tokenizer</a></span>
756</td>
757<td class="age"><span class="css-truncate css-truncate-target"><time class="js-relative-date" datetime="2014-01-24T01:27:43-08:00" title="2014-01-24 01:27:43">January 24, 2014</time></span></td>
758</tr>
759</tbody>
760
761</table>
762</div>
763
764<div id="readme" class="clearfix announce instapaper_body md">
765<span class="name">
766<span class="octicon octicon-book"></span>
767README.md
768</span>
769
770<article class="markdown-body entry-content" itemprop="mainContentOfPage"><h1>
771<a name="parse5" class="anchor" href="#parse5"><span class="octicon octicon-link"></span></a>parse5</h1>
772
773<p>Fast full-featured HTML parser for Node. Based on WHATWG HTML5 specification.<br>
774To build <a href="http://testcafe.devexpress.com/">TestCafé</a> we needed fast and ready for production HTML parser for node.js, which will parse HTML as a modern browser's parser.
775Existing solutions were either too slow or their output was too inaccurate. So, this is how parse5 was born.</p>
776
777<h2>
778<a name="install" class="anchor" href="#install"><span class="octicon octicon-link"></span></a>Install</h2>
779
780<pre><code>$ npm install parse5
781</code></pre>
782
783<h2>
784<a name="usage-and-api" class="anchor" href="#usage-and-api"><span class="octicon octicon-link"></span></a>Usage and API</h2>
785
786<div class="highlight highlight-js"><pre><span class="kd">var</span> <span class="nx">Parser</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'parse5'</span><span class="p">).</span><span class="nx">Parser</span><span class="p">;</span>
787
788<span class="c1">//Instantiate parser</span>
789<span class="kd">var</span> <span class="nx">parser</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Parser</span><span class="p">();</span>
790
791<span class="c1">//Then feed it with an HTML document</span>
792<span class="kd">var</span> <span class="nb">document</span> <span class="o">=</span> <span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="s1">'&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi there!&lt;/body&gt;&lt;/html&gt;'</span><span class="p">)</span>
793
794<span class="c1">//Now let's parse HTML-snippet</span>
795<span class="kd">var</span> <span class="nx">fragment</span> <span class="o">=</span> <span class="nx">parser</span><span class="p">.</span><span class="nx">parseFragment</span><span class="p">(</span><span class="s1">'&lt;title&gt;Parse5 is &amp;#102;&amp;#117;&amp;#99;&amp;#107;ing awesome!&lt;/title&gt;&lt;h1&gt;42&lt;/h1&gt;'</span><span class="p">);</span>
796
797</pre></div>
798
799<h2>
800<a name="is-it-fast" class="anchor" href="#is-it-fast"><span class="octicon octicon-link"></span></a>Is it fast?</h2>
801
802<p>Check out <a href="https://github.com/inikulin/node-html-parser-bench">this benchmark</a>.</p>
803
804<pre><code>Starting benchmark. Fasten your seatbelts...
805html5 (https://github.com/aredridel/html5) x 0.18 ops/sec ±5.92% (5 runs sampled)
806htmlparser (https://github.com/tautologistics/node-htmlparser/) x 3.83 ops/sec ±42.43% (14 runs sampled)
807htmlparser2 (https://github.com/fb55/htmlparser2) x 4.05 ops/sec ±39.27% (15 runs sampled)
808parse5 (https://github.com/inikulin/parse5) x 3.04 ops/sec ±51.81% (13 runs sampled)
809Fastest is htmlparser2 (https://github.com/fb55/htmlparser2),parse5 (https://github.com/inikulin/parse5)
810</code></pre>
811
812<p>So, parse5 is as fast as simple specification incompatible parsers and ~15-times(!) faster than the current specification compatible parser available for the node.</p>
813
814<h2>
815<a name="testing" class="anchor" href="#testing"><span class="octicon octicon-link"></span></a>Testing</h2>
816
817<p>Test data is adopted from <a href="https://github.com/html5lib">html5lib project</a>. Parser is covered by more than 8000 test cases.
818To run tests:</p>
819
820<pre><code>$ node test/run_tests.js
821</code></pre>
822
823<h2>
824<a name="custom-tree-adapter" class="anchor" href="#custom-tree-adapter"><span class="octicon octicon-link"></span></a>Custom tree adapter</h2>
825
826<p>You can create a custom tree adapter so parse5 can work with your own DOM-tree implementation.
827Just pass your adapter implementation to the parser's constructor as an argument:</p>
828
829<div class="highlight highlight-js"><pre><span class="kd">var</span> <span class="nx">Parser</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'parse5'</span><span class="p">).</span><span class="nx">Parser</span><span class="p">;</span>
830
831<span class="kd">var</span> <span class="nx">myTreeAdapter</span> <span class="o">=</span> <span class="p">{</span>
832<span class="c1">//Adapter methods...</span>
833<span class="p">};</span>
834
835<span class="c1">//Instantiate parser</span>
836<span class="kd">var</span> <span class="nx">parser</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Parser</span><span class="p">(</span><span class="nx">myTreeAdapter</span><span class="p">);</span>
837</pre></div>
838
839<p>Sample implementation can be found <a href="https://github.com/inikulin/parse5/blob/master/lib/default_tree_adapter.js">here</a>.
840The custom tree adapter should implement all methods exposed via <code>exports</code> in the sample implementation.</p>
841
842<h2>
843<a name="questions-or-suggestions" class="anchor" href="#questions-or-suggestions"><span class="octicon octicon-link"></span></a>Questions or suggestions?</h2>
844
845<p>If you have any questions, please feel free to create an issue <a href="https://github.com/inikulin/parse5/issues">here on github</a>.</p>
846
847<h2>
848<a name="author" class="anchor" href="#author"><span class="octicon octicon-link"></span></a>Author</h2>
849
850<p><a href="https://github.com/inikulin">Ivan Nikulin</a> (<a href="mailto:ifaaan@gmail.com">ifaaan@gmail.com</a>)</p>
851
852<p><a href="https://bitdeli.com/free" title="Bitdeli Badge"><img src="https://d2weczhvl823v0.cloudfront.net/inikulin/parse5/trend.png" alt="Bitdeli Badge" style="max-width:100%;"></a></p></article>
853</div>
854
855
856</div>
857
858</div><!-- /.repo-container -->
859<div class="modal-backdrop"></div>
860</div><!-- /.container -->
861</div><!-- /.site -->
862
863
864</div><!-- /.wrapper -->
865
866<div class="container">
867<div class="site-footer">
868<ul class="site-footer-links right">
869<li><a href="https://status.github.com/">Status</a></li>
870<li><a href="http://developer.github.com">API</a></li>
871<li><a href="http://training.github.com">Training</a></li>
872<li><a href="http://shop.github.com">Shop</a></li>
873<li><a href="/blog">Blog</a></li>
874<li><a href="/about">About</a></li>
875
876</ul>
877
878<a href="/">
879<span class="mega-octicon octicon-mark-github" title="GitHub"></span>
880</a>
881
882<ul class="site-footer-links">
883<li>© 2014 <span title="0.04649s from github-fe139-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
884<li><a href="/site/terms">Terms</a></li>
885<li><a href="/site/privacy">Privacy</a></li>
886<li><a href="/security">Security</a></li>
887<li><a href="/contact">Contact</a></li>
888</ul>
889</div><!-- /.site-footer -->
890</div><!-- /.container -->
891
892
893<div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
894<div class="fullscreen-container js-fullscreen-container">
895<div class="textarea-wrap">
896<textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
897<div class="suggester-container">
898<div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester" data-url="/inikulin/parse5/suggestions/commit">
899</div>
900</div>
901</div>
902</div>
903<div class="fullscreen-sidebar">
904<a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
905<span class="mega-octicon octicon-screen-normal"></span>
906</a>
907<a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards" title="Switch themes">
908<span class="octicon octicon-color-mode"></span>
909</a>
910</div>
911</div>
912
913
914
915<div id="ajax-error-message" class="flash flash-error">
916<span class="octicon octicon-alert"></span>
917<a href="#" class="octicon octicon-remove-close close js-ajax-error-dismiss"></a>
918Something went wrong with that request. Please try again.
919</div>
920
921
922
923
924</body></html>