Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Inline CSS always commented by HeadStyle ViewHelper #165

Open
@tworzenieweb

Description

@tworzenieweb

It looks like the inline style definition is not correctly printed by HeadStyle view helper.

Considering the following one:

<?php $this->headStyle()->captureStart(); ?>
@media only screen and (max-width: 620px) {

div[class*="pd-left20"]{padding:0 0 0 20px !important;}
td[class*="resetPadding"]{padding:0 0 0 0 !important;}
td[class*="padding20"]{padding:20px 0 20px 0 !important;}

}
<?php $this->headStyle()->captureEnd(); ?>

The whole block will be commented out.

I tried disabling auto escaper but escaping is hardcoded into HeadStyle implementation.

Actually, after a deep look in the code, I don't get why CSS content is always commented via <!-- -->:

[0]

 $html = '<style type="text/css"' . $attrString . '>' . PHP_EOL
            . $escapeStart . $indent . $item->content . PHP_EOL . $escapeEnd
            . '</style>';

$escapeStart and $escapeEnd can be null only for conditional CSS which is not a regular use case.

The examples from documentation are giving me similar commented output. [1]

[0] https://github.com/zendframework/zend-view/blob/master/src/Helper/HeadStyle.php#L328
[1] https://docs.zendframework.com/zend-view/helpers/head-style/#capturing-style-declarations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions