Skip to content

Fix <title> tag double HTML escaping#1626

Merged
zachmargolis merged 1 commit intomasterfrom
margolis-fix-title-interpolation
Aug 18, 2017
Merged

Fix <title> tag double HTML escaping#1626
zachmargolis merged 1 commit intomasterfrom
margolis-fix-title-interpolation

Conversation

@zachmargolis
Copy link
Contributor

Why: To fix rendering in browsers


before:

screenshot_8_18_17__11_21_am 2

after:

screenshot_8_18_17__11_21_am

**Why**: To fix rendering in browsers
meta http-equiv="refresh" content="#{yield(:meta_refresh)}"

title
= content_for?(:title) ? APP_NAME + ' - ' + yield(:title) : APP_NAME
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the + ends up creating an HTML-unsafe value, where this approach will check each piece separate for HTML-safeness before rendering (the result of the yield may already be HTML safe, as it was in the buggy case)

Copy link
Contributor

@jmhooper jmhooper left a comment

Choose a reason for hiding this comment

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

👍

@zachmargolis zachmargolis merged commit 79fc629 into master Aug 18, 2017
@zachmargolis zachmargolis deleted the margolis-fix-title-interpolation branch August 21, 2017 13:55
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.

2 participants