Commit Graph

11 Commits

Author SHA1 Message Date
Gijs Kruitbosch
f782bc5f06 Avoid global flag when looking for metadata using regexes 2018-08-21 17:56:25 +02:00
David A Roberts
656a6673d9 Don't put non-phrasing content into paragraphs 2018-05-16 10:43:30 +01:00
David A Roberts
9f2c5cb42e Put phrasing content into paragraphs
This removes the need for `p.readability-styled` elements.
2018-05-15 13:29:55 +01:00
David A Roberts
f8d9b1c224 Update test expectations 2018-03-19 13:20:29 +00:00
Gijs Kruitbosch
ad4dd26448 Update test expectations 2017-11-30 10:41:15 +00:00
Cameron McCormack
5ad448f831 Update test expectations. 2017-11-21 10:04:59 +00:00
Taylor Hunt
b7c32feb25 Remove presentational HTML attributes (#385)
* Remove presentational HTML attributes

Fixes #383

This patch loops through a list of known-presentational attributes in HTML, attempting to remove each from each cleaned element. (Checking for the attribute's existence first seems to just add needless overhead.)

The extra check for the HTML namespace is to avoid removing attributes that inline SVG needs.

* Only remove `width`/`height` for certain elements

Embedded media elements are allowed to have them, but not others.

* Address PR feedback

* Fix loop index formatting
* Only remove `width`/`height` from certain elements
* Combine logic into a single check/remove

* Attempt fixing my recursion

* One weird trick to get your loops to run

* Add inline SVG bailout

Try not to touch any styles for `<svg>`, because it's inherently presentational.

* Update tests to match newly-removed attributes

* Oh those wacky SVGs

The `position:absolute` is a trick to import clipping paths into the document without putting a big 300×150 empty space in it. (`display:none` and such disable the clipPath in some browsers.)

* Whoops, missed some `width`s

* Normalize SVG tagName

JSDOMParser differs from the official DOM here
2017-08-09 20:26:34 +01:00
Evan Tseng
0f147374b7 Bug 1323861 - Remove the readScript method, r=Gijs 2017-02-22 09:39:17 +00:00
Sebastian Hengst
5e9c7a3910 Bug 1322327 - Only remove images which are not descendants of a figure if there is more than one image, update affected tests 2016-12-21 16:31:25 +00:00
Gijs Kruitbosch
46842048c1 Use jsdom for parsing the document to determine readability (fixes #325) 2016-12-14 13:44:29 +00:00
Evan Tseng
4fa0d1b207 Bug 1177619 - Score div nodes which have br nodes. r=Gijs 2016-11-01 10:25:57 +00:00