Class CssInlineImpl

java.lang.Object
ch.tocco.nice2.toolbox.impl.css.CssInlineImpl
All Implemented Interfaces:
CssInline

@Component public class CssInlineImpl extends Object implements CssInline
  • Constructor Details

    • CssInlineImpl

      public CssInlineImpl()
  • Method Details

    • setNewParser

      @Value("${cssinline.newparser}") public void setNewParser(boolean newParser)
    • inlineCss

      public String inlineCss(String html)
      Description copied from interface: CssInline
      Moves the CSS rules from the <style> blocks in the document head to the elements. It always returns a complete html document (with <html> root tag), even if given only a html snippet.
      Specified by:
      inlineCss in interface CssInline
    • inlineCss

      public String inlineCss(String html, String css)
      Description copied from interface: CssInline
      Moves the CSS rules from the <style> blocks in the document head to the elements and also inlines the given CSS into the html using `style` attributes. It always returns a complete html document (with <html> root tag), even if given only a html snippet.
      Specified by:
      inlineCss in interface CssInline
    • getElementStyles

      public Map<String,String> getElementStyles(String html, String selector)
      Description copied from interface: CssInline
      Moves the CSS rules from the <style> blocks in the document head to the elements and returns all styles of the first element that matches the selector.
      Specified by:
      getElementStyles in interface CssInline
      Parameters:
      html - HTML string with styles in document head
      selector - The element to select (styles for first matching element are returned)
      Returns:
      all styles of the first element that matches the selector.
    • getElementStyles

      public Map<String,String> getElementStyles(String html, String selector, Predicate<CssInline.Rule> ruleFilter)
      Description copied from interface: CssInline
      Same as CssInline.getElementStyles(String, String), but only inlines the rules for which the given ruleFilter predicate returns true.
      Specified by:
      getElementStyles in interface CssInline