Fixed amp syntax issues
authorMarcel Werk <burntime@woltlab.com>
Sun, 8 Jan 2017 18:41:05 +0000 (19:41 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sun, 8 Jan 2017 18:41:12 +0000 (19:41 +0100)
wcfsetup/install/files/lib/system/html/output/AmpHtmlOutputProcessor.class.php

index 7f7c338e55611915086b3d43f6939c6b1a61f38c..97bb5bf85955f4c559dee6d1f87a11d90b28556d 100644 (file)
@@ -89,6 +89,19 @@ class AmpHtmlOutputProcessor extends HtmlOutputProcessor {
                                DOMUtil::removeNode($element);
                        }
                }
+               
+               // strip invalid attribute 'style'
+               /** @var \DOMElement $element */
+               foreach ($this->getHtmlOutputNodeProcessor()->getXPath()->query('//*[@style]') as $element) {
+                       $element->removeAttribute('style');
+               }
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function getHtml() {
+               return str_ireplace('<img', '<amp-img layout="flex-item"', $this->getHtmlOutputNodeProcessor()->getHtml());
        }
        
        /**