-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline CSS always commented by HeadStyle ViewHelper #6
Labels
Comments
The comments are used for backward compatibility in old browsers and are ignored by CSS. But today these comments are obsolete and can be removed without problems. Originally posted by @froschdesign at zendframework/zend-view#165 (comment) |
gsteel
added a commit
to gsteel/laminas-view
that referenced
this issue
Jul 19, 2023
Closes laminas#6 It is not necessary to comment CSS within style tags so output has changed from: `<style><!-- a {} --></style>` to `<style> a {} </style>` The `<style media="">` attribute was restricted to list of pre-defined values such as `[screen, print, braille]`, when in reality the media attribute can contain any sort of media query such as `screen and (min-width: 10rem)`. These restrictions have been removed the property listing those restrictions deprecated. Additionally, if the `media` attribute is an array containing non-string values, an exception will be thrown. Previously, there would have been a type error. Style tag attributes not present in a list of 'allowed' attributes are silently ignored. This list has been updated to include the `nonce` attribute. Adds `@method setIndent` which magically proxies to the container. Adds probably desirable behaviour where if the user provides an empty string, i.e. `$this->headStyle()->appendStyle('');`, then no markup will be output for that item. Lots of type inference improvements and some test improvements. Signed-off-by: George Steel <george@net-glue.co.uk>
gsteel
added a commit
to gsteel/laminas-view
that referenced
this issue
Jul 19, 2023
Closes laminas#6 It is not necessary to comment CSS within style tags so output has changed from: `<style><!-- a {} --></style>` to `<style> a {} </style>` The `<style media="">` attribute was restricted to list of pre-defined values such as `[screen, print, braille]`, when in reality the media attribute can contain any sort of media query such as `screen and (min-width: 10rem)`. These restrictions have been removed the property listing those restrictions deprecated. Additionally, if the `media` attribute is an array containing non-string values, an exception will be thrown. Previously, there would have been a type error. Style tag attributes not present in a list of 'allowed' attributes are silently ignored. This list has been updated to include the `nonce` attribute. Adds `@method setIndent` which magically proxies to the container. Adds probably desirable behaviour where if the user provides an empty string, i.e. `$this->headStyle()->appendStyle('');`, then no markup will be output for that item. Lots of type inference improvements and some test improvements. Signed-off-by: George Steel <george@net-glue.co.uk>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like the inline style definition is not correctly printed by HeadStyle view helper.
Considering the following one:
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]
$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
Originally posted by @tworzenieweb at zendframework/zend-view#165
The text was updated successfully, but these errors were encountered: