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

fix ignore newline by after textarea's opening tag #1736

Merged
merged 1 commit into from Aug 7, 2014

Conversation

Projects
None yet
2 participants
@krororo
Contributor

krororo commented Aug 7, 2014

The textarea tag is missing first newline. I want to save the input as content.

From the HTML 4.01 specification appendices:

SGML (see [ISO8879], section 7.6.1) specifies that a line break immediately following a start tag must be ignored, as must a line break immediately before an end tag. This applies to all HTML elements without exception.
The following two HTML examples must be rendered identically:

So insert newline after the textarea opening tag.

for example

text_area_tag :test, value: "\n\nfoo\nbar"

output html is

<textarea name="test">\n\nfoo\nbar</textarea>

But what is sent to the server is the only "\nfoo\nbar".

I want to solve this problem.

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Aug 7, 2014

Member

So if I understand correctly, you want browsers to render an intended leading newline correctly by adding another one that's guaranteed to be ignored due to the ISO?

Member

ujifgc commented Aug 7, 2014

So if I understand correctly, you want browsers to render an intended leading newline correctly by adding another one that's guaranteed to be ignored due to the ISO?

ujifgc added a commit that referenced this pull request Aug 7, 2014

Merge pull request #1736 from krororo/fix-ignore-newline
fix textarea value with leading newline

@ujifgc ujifgc merged commit 0076c25 into padrino:master Aug 7, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Aug 7, 2014

Member

Thanks!

Member

ujifgc commented Aug 7, 2014

Thanks!

ujifgc added a commit that referenced this pull request Aug 20, 2014

fix regression of #1736, improve test
after #1736 it was not possible to render textareas with safe html content (html tags)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment