Commit Graph

5 Commits (89572ad29a7c6bc04b944ad9a23f7982412e6a63)

Author SHA1 Message Date
Maria Luiza Soares 8c41d92560 Assert on siteName in all test cases 6 years ago
Gijs Kruitbosch ad4dd26448 Update test expectations 7 years ago
Cameron McCormack 5ad448f831 Update test expectations. 7 years ago
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
7 years ago
Evan Tseng 0e147aa722 Bug 1346717 - Tests for youth.cn, r=Gijs 7 years ago