Skip to content
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

Clean up HeadStyle View Helper #209

Merged
merged 1 commit into from
Jul 19, 2023
Merged

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Jul 19, 2023

Closes #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.

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 gsteel added this to the 2.29.0 milestone Jul 19, 2023
Copy link
Member

@froschdesign froschdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement and long overdue. 👍🏻

(Yes, the output is changed, but that doesn't matter with testing tools like Playwright or Cypress.)

@gsteel gsteel merged commit 78a42cf into laminas:2.29.x Jul 19, 2023
@gsteel gsteel deleted the inline-style-comments branch July 19, 2023 12:14
@gsteel gsteel self-assigned this Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline CSS always commented by HeadStyle ViewHelper
2 participants