AMP_Style_Sanitizer::sanitize PHP Method

sanitize() public method

public sanitize ( )
    public function sanitize()
    {
        $body = $this->get_body_node();
        $this->collect_styles_recursive($body);
    }

Usage Example

 /**
  * @dataProvider get_data
  */
 public function test_sanitizer($source, $expected_content, $expected_stylesheet)
 {
     $dom = AMP_DOM_Utils::get_dom_from_content($source);
     $sanitizer = new AMP_Style_Sanitizer($dom);
     $sanitizer->sanitize();
     // Test content
     $content = AMP_DOM_Utils::get_content_from_dom($dom);
     $this->assertEquals($expected_content, $content);
     // Test stylesheet
     $stylesheet = $sanitizer->get_styles();
     $this->assertEquals($expected_stylesheet, $stylesheet);
 }