Automattic / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
3.12k stars 221 forks source link

Add support for 'auto' as value for height/width properties #428

Closed m1san closed 2 years ago

m1san commented 2 years ago

What? Add support for auto as value for height/width properties Why? Scenarios like Outllook Windows support setting width only as attribute but resetting to auto is not possible with the current behavior, this allows to add width="auto" when applicable.

> mocha --reporter spec && npm run test-typescript

  ✓ cli parses options
  ✓ cli no css (502ms)
  ✓ cli css included (307ms)
  ✓ cli options included (283ms)
  ✓ cli supports codeBlock (281ms)
  ✓ extracting selectors
  ✓ selector specificity comparison
  ✓ selector specificity calculator
  ✓ property comparison based on selector specificity
  ✓ property toString
  ✓ parse simple css into a object structure
  ✓ parse complex css into a object structure
  ✓ test excludedProperties setting
  ✓ test juice
  ✓ test consecutive important rules
  ✓ test * specificity
  ✓ test style attributes priority
  ✓ test style attributes and important priority
  ✓ test style attributes and important priority
  ✓ test that preserved text order is stable
  ✓ alpha
  ✓ cascading
  ✓ cheerio
  ✓ class+id
  ✓ class
  ✓ css-quotes
  ✓ direct-descendents
  ✓ ejs-unterminated
  ✓ ejs
  ✓ empty
  ✓ entities
  ✓ hbs-unterminated
  ✓ hbs
  ✓ id
  ✓ identical-important
  ✓ ignore-pseudos
  ✓ important-specificity
  ✓ important
  ✓ improper-syntax-affect-cascade-issue44
  ✓ inline-specificity
  ✓ integration
  ✓ linear-gradient-space-issue-226
  ✓ media
  ✓ multiple-properties-occourences
  ✓ normalize
  ✓ not-xhtml
  ✓ php
  ✓ preserve-events
  ✓ propertyorder
  ✓ pseudo-specificity
  ✓ regression-media
  ✓ regression-selector-newline
  ✓ shorthand
  ✓ specificity
  ✓ specificitygte10
  ✓ style-preservation
  ✓ tag
  ✓ templates
  ✓ yui-reset
  ✓ juice(html)
  ✓ juice(document) with htmlparser2
  ✓ juice-content/embed
  ✓ juice-content/empty-style-tag
Not found, skipping: not-a-file.css
  ✓ juice-content/file-missing
  ✓ juice-content/font-face-preserve
  ✓ juice-content/font-quotes
  ✓ juice-content/height-attr
  ✓ juice-content/important
  ✓ juice-content/insert-preserve-fragment
  ✓ juice-content/keyframes-preserve
  ✓ juice-content/lt-in-comments-issue216
  ✓ juice-content/media-preserve
  ✓ juice-content/ms-filter-syntax-issue74
  ✓ juice-content/no-css
  ✓ juice-content/non-visual
  ✓ juice-content/prevent-css-gradient-in-attribute-issue319
  ✓ juice-content/pseudo-elements-and-width-attr
  ✓ juice-content/pseudo-elements
  ✓ juice-content/pseudo-selector-preserve
  ✓ juice-content/relative-url (101ms)
  ✓ juice-content/table-attr
  ✓ juice-content/width-attr
  ✓ juice-content/xml
  ✓ doctype
  ✓ no_css
  ✓ two_styles
  ✓ remote_url (54ms)
  ✓ spaces_in_path
  ✓ inlineContent

  89 passing (2s)