Skip to content

Commit b293714

Browse files
committed
#558: Content Types Output Style Attribute Removal
- Adding Body ID - Minor Refactoring
1 parent 30ffcdb commit b293714

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
class PageBuilderStripStyles implements DataConverterInterface
2020
{
21+
const BODY_ID = 'html-body';
22+
const DATA_ATTRIBUTE = 'data-pb-style';
23+
2124
/**
2225
* @var DOMDocument
2326
*/
@@ -52,7 +55,7 @@ private function generateInternalStyles(array $styleMap): string
5255
$output = '';
5356

5457
foreach ($styleMap as $selector => $styles) {
55-
$output .= '[data-pb-style="' . $selector . '"]';
58+
$output .= '#' . self::BODY_ID . ' [' . self::DATA_ATTRIBUTE . '="' . $selector . '"]';
5659
$output .= '{' . $styles . '}';
5760
}
5861

@@ -80,7 +83,7 @@ public function convert($value)
8083

8184
if ($styleAttr) {
8285
$generatedDataAttribute = $this->generateDataAttribute();
83-
$node->setAttribute('data-pb-style', $generatedDataAttribute);
86+
$node->setAttribute(self::DATA_ATTRIBUTE, $generatedDataAttribute);
8487
$styleMap[$generatedDataAttribute] = $styleAttr; // Amend Array for Internal Style Generation
8588
$node->removeAttribute('style');
8689
}

0 commit comments

Comments
 (0)