Android also ships a parser that we wrote for Reader mode:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/JSDOMParser.js

We've talked about extending it to also do phone number/address detection as 
well, but haven't tried (reader mode doesn't need to modify the original dom, 
unlike the examples here). Memory use (during the parse) isn't great, so the 
streaming parser actually sounds interesting... Thanks :)

- Wes

----- Original Message -----
From: "Andrew Sutherland" <asutherl...@asutherland.org>
To: dev-platform@lists.mozilla.org
Sent: Monday, March 3, 2014 3:57:04 PM
Subject: Re: How to efficiently walk the DOM tree and its strings

On 03/03/2014 03:19 PM, Boris Zbarsky wrote:
> That said, there might be JS implementations of an HTML5 parser out there.

The Gaia e-mail app has a streaming HTML parser in its worker-friendly 
sanitizer at 
https://github.com/mozilla-b2g/bleach.js/blob/worker-thread-friendly/lib/bleach.js.
 
It's derived from jresig's 
http://ejohn.org/blog/pure-javascript-html-parser/

Note: There are probably better options out there, just thought I'd call 
it out.

Andrew
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to