Closed
Description
Related (closed) issue: #65
I'm not sure whether this is considered a bug or if it's working as intended, but I'll at least throw in a vote that the behavior is unexpected. Given the following example:
var Test = React.createClass({
render: function() {
return (
<p>
Demonstration of <span>unexpected</span>
whitespace handling in
<span>ReactJS</span>.
</p>
);
}
});
React.render(<Test />, document.body)
I would suggest that the expected rendered output of the above component would be:
Demonstration of unexpected whitespace handling in ReactJS.
Whereas the actual output is:
Demonstration of unexpectedwhitespace handling inReactJS.
(No whitespace between "unexpected" and "whitespace" or between "in" and "ReactJS").
I would consider this unexpected for two primary reasons:
- It's inconsistent with HTML's handling of whitespace.
- Removing the
<span>
tags (but leaving newlines and indentations unchanged) causes whitespace to be preserved.
If this is simply a bug, then I suppose there's no need to belabor the point. If not, is there some rationale for leading/trailing tags behaving different than leading/trailing plain text?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels