CssInliner
This class provides functions for converting CSS styles into inline style attributes in your HTML code.
Description Description
For Emogrifier 3.0.0, this will be the successor to the \Pelago\Emogrifier class (which then will be deprecated).
For more information, please see the README.md file.
Source Source
File: vendor/pelago/emogrifier/src/Emogrifier/CssInliner.php
Methods Methods
- addAllowedMediaType — Marks a media query type to keep.
- addExcludedSelector — Adds a selector to exclude nodes from emogrification.
- addStyleElementToDocument — Adds a style element with $css to $this->domDocument.
- attributeValueIsImportant — Checks whether $attributeValue is marked as !important.
- clearAllCaches — Clears all caches.
- copyInlinableCssToStyleAttribute — Copies $cssRule into the style attribute of $node.
- copyUninlinableCssToStyleNode — Applies `$this->matchingUninlinableCssRules` to `$this->domDocument` by placing them as CSS in a `` element.
- determineMatchingUninlinableCssRules — Determines which of `$cssRules` actually apply to `$this->domDocument`, and sets them in `$this->matchingUninlinableCssRules`.
- disableInlineStyleAttributesParsing — Disables the parsing of inline styles.
- disableStyleBlocksParsing — Disables the parsing of blocks.
- existsMatchForCssSelector — Checks whether there is at least one matching element for $cssSelector.
- existsMatchForSelectorInCssRule — Checks whether there is at least one matching element for the CSS selector contained in the `selector` element of the provided CSS rule.
- extractImportAndCharsetRules — Extracts `@import` and `@charset` rules from the supplied CSS. These rules must not be preceded by any other rules, or they will be ignored. (From the CSS 2.1 specification: "CSS 2.1 user agents must ignore any '@import' rule that occurs inside a block or after any non-ignored statement other than an @charset or an @import rule." Note also that `@charset` is case sensitive whereas `@import` is not.)
- fillStyleAttributesWithMergedStyles — Merges styles from styles attributes and style nodes and applies them to the attribute nodes
- generateStyleStringFromDeclarationsArrays — This method merges old or existing name/value array with new name/value array and then generates a string of the combined style suitable for placing inline.
- generateStyleStringFromSingleDeclarationsArray — Generates a CSS style string suitable to be used inline from the $styleDeclarations property => value array.
- getAllNodesWithStyleAttribute — Returns a list with all DOM nodes that have a style attribute.
- getCssFromAllStyleNodes — Returns CSS content.
- getCssRuleMatches — Parses a string of CSS into the media query, selectors and declarations for each ruleset in order.
- getCssSelectorConverter
- getCssSelectorPrecedence
- getHeadElement — Returns the HEAD element.
- getMatchingUninlinableSelectors — Gets the array of selectors present in the CSS provided to `inlineCss()` for which the declarations could not be applied as inline styles, but which may affect elements in the HTML. The relevant CSS will have been placed in a `` element. The selectors may include those used within `@media` rules or those involving dynamic pseudo-classes (such as `:hover`) or pseudo-elements (such as `::after`).
- getNodesToExclude — Find the nodes that are not to be emogrified.
- inlineCss — Inlines the given CSS into the existing HTML.
- normalizeStyleAttributes — Normalizes the value of the "style" attribute and saves it.
- normalizeStyleAttributesOfAllNodes — Parses the document and normalizes all existing CSS attributes.
- parseCssDeclarationsBlock — Parses a CSS declaration block into property name/value pairs.
- parseCssRules — Extracts and parses the individual rules from a CSS string.
- purgeVisitedNodes — Purges the visited nodes.
- removeAllowedMediaType — Drops a media query type from the allowed list.
- removeCssComments — Removes comments from the supplied CSS.
- removeExcludedSelector — No longer excludes the nodes matching this selector from emogrification.
- removeImportantAnnotationFromAllInlineStyles — Searches for all nodes with a style attribute and removes the "!important" annotations out of the inline style declarations, eventually by rearranging declarations.
- removeImportantAnnotationFromNodeInlineStyle — Removes the "!important" annotations out of the inline style declarations, eventually by rearranging declarations.
- removeUnmatchablePseudoComponents — Removes pseudo-elements and dynamic pseudo-classes from a CSS selector, replacing them with "*" if necessary.
- replaceUnmatchableNotComponent — Helps `removeUnmatchablePseudoComponents()` replace or remove a selector `:not(.
- setDebug — Sets the debug mode.
- sortBySelectorPrecedence
- splitCssAndMediaQuery — Splits input CSS code into an array of parts for different media queries, in order.