package cascade

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Apply.MakeSource

Parameters

Signature

Sourceval compute : ?minimal:bool -> sheet:Stylesheet.t -> Node.t list -> Node.t result

compute ?minimal ~sheet roots resolves sheet against the element trees rooted at roots and returns, for each element, the declarations to set on its style attribute, the un-inlinable rules as a <style> body, and the count of kept rules. minimal (default false) drops an inherited declaration that only restates the value the element already inherits from its ancestors.

The argument is a parsed stylesheet rather than CSS text so that the parse stays with the caller: a stylesheet Css.of_string had to recover, and one that was empty to begin with, both project onto nothing, and only the Css.parse.warnings it returns tell them apart. Parsing here would swallow that difference and report the two as the same empty result.