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

Leading and trailing space being added if PHP code is inside a form attribute #502

Closed
wonderboyjon opened this issue Feb 23, 2016 · 1 comment

Comments

@wonderboyjon
Copy link

Context:
I'm minify-ing a file that contains both HTML and PHP content. For the most part this works completely fine. However, in the case where I am using PHP to set/echo an HTML attribute value (when I need a variable calculated from code), the minification process adds a leading and trailing whitespace around the PHP tags. This especially causes problems if the attribute is an element ID, as the extra space ruins any JS selectors that are expecting an ID without white space.

Example:
<table id="<?php echo $this->escapeHtmlAttr($this->table_id); ?>" >

becomes

<table id=" <?php echo $this->escapeHtmlAttr($this->table_id); ?> " >

The only options I have set are
removeComments: true,
collapseWhitespace: true

@alexlamsl
Copy link
Collaborator

Oops, missed out that case - fix submitted in #501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants