New lines are not handled properly in special attributes #535

Merged
merged 3 commits into from Nov 11, 2013

Conversation

Projects
None yet
2 participants
@ccummings
Contributor

ccummings commented Nov 8, 2013

When there is a new line character in the value of a specialAttribute like style, the getValue helper does not strip the leading and trailing quotes because the regex fails. Specifically the .* in the regex only matches non-newline characters.

So a mustache template like this will not set the styles properly.

<div style="height: {{height}};
width: {{width}};"></div>
@ccummings

This comment has been minimized.

Show comment
Hide comment
@ccummings

ccummings Nov 8, 2013

Contributor

Fix is to strip out new lines so the second regex passes.

We could have changed the regex (.* to [^]*) to match across new lines, but this would pass a value with a new line to the special attribute setter which may not behave properly in some browsers.

Contributor

ccummings commented Nov 8, 2013

Fix is to strip out new lines so the second regex passes.

We could have changed the regex (.* to [^]*) to match across new lines, but this would pass a value with a new line to the special attribute setter which may not behave properly in some browsers.

daffl added a commit that referenced this pull request Nov 11, 2013

Merge pull request #535 from bitovi/specialAttr-newLine
New lines are not handled properly in special attributes

@daffl daffl merged commit dd60785 into master Nov 11, 2013

1 check passed

default The Travis CI build passed
Details

@daffl daffl deleted the specialAttr-newLine branch Nov 11, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment