Skip to content

Commit 3790cc3

Browse files
committed
#558: Content Types Output Style Attribute Removal
- Code Review Feedback/Amends
1 parent 3dffe71 commit 3790cc3

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

app/code/Magento/PageBuilder/Setup/Converters/PageBuilderStripStyles.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010

1111
use DOMDocument;
1212
use DOMElement;
13-
use DOMException;
14-
use DOMNode;
1513
use DOMXPath;
16-
use Exception;
1714
use Magento\Framework\DB\DataConverter\DataConverterInterface;
1815

1916
/**
@@ -73,11 +70,8 @@ public function convert($value)
7370
$document = new DOMDocument();
7471
$document->loadHTML($value);
7572
$xpath = new DOMXPath($document);
76-
77-
// Query for Inline Styles
78-
$nodes = $xpath->query('//*[@style]');
79-
80-
$styleMap = array();
73+
$nodes = $xpath->query('//*[@style]'); // Query for Inline Styles
74+
$styleMap = [];
8175

8276
foreach ($nodes as $node) {
8377
/* @var DOMElement $node */
@@ -86,11 +80,7 @@ public function convert($value)
8680
if ($styleAttr) {
8781
$generatedDataAttribute = $this->generateDataAttribute();
8882
$node->setAttribute('data-pb-style', $this->generateDataAttribute());
89-
90-
// Add for Internal Style Generation
91-
$styleMap[$generatedDataAttribute] = $styleAttr;
92-
93-
// Strip Inline Styles
83+
$styleMap[$generatedDataAttribute] = $styleAttr; // Amend Array for Internal Style Generation
9484
$node->removeAttribute('style');
9585
}
9686
}
@@ -100,7 +90,6 @@ public function convert($value)
10090
'style',
10191
$this->generateInternalStyles($styleMap)
10292
);
103-
$style->setAttribute('type', 'text/css');
10493
$xpath->query('//body')[0]->appendChild($style); // @todo: Refactor
10594

10695
// @todo: Refactor

0 commit comments

Comments
 (0)