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

Use comment nodes for empty components #5451

Merged
merged 1 commit into from
Nov 20, 2015

Conversation

sophiebits
Copy link
Collaborator

This makes more sense and avoids DOM nesting problems.

image

(ReactSimpleEmptyComponent isn't used here but React Native can use it as it currently does, with View.)

This makes more sense and avoids DOM nesting problems.

![image](https://cloud.githubusercontent.com/assets/6820/11098713/952348ca-885b-11e5-9757-e4a76467b0b8.png)

(ReactSimpleEmptyComponent isn't used here but React Native can use it as it currently does.)
@quantizor
Copy link
Contributor

@spicyj I was hoping this would come to pass. I remember it was discussed and ultimately postponed by @syranide (I believe) because of some IE whitespace issues. Have those been resolved or obviated by removing support for old IE?

@sophiebits
Copy link
Collaborator Author

Only reference I can find is #4550 which shouldn't actually be an issue because we work around it in our setInnerHTML module.

@quantizor
Copy link
Contributor

👍 excellent

@mwiencek
Copy link
Contributor

With unencrypted HTTP, you'll need to set a Cache-Control: no-transform response header if you don't want certain mobile providers to strip comments. This is a problem we had with Knockout.

@sophiebits
Copy link
Collaborator Author

I thought Knockout is a client-side library only?

@sophiebits sophiebits closed this Nov 11, 2015
@sophiebits sophiebits reopened this Nov 11, 2015
@mwiencek
Copy link
Contributor

Yup, though Knockout bindings are just attributes/comments in the HTML, so it was common to just render the initial page containing all the knockout-y bits with whatever server-side templating language you were using, then call applyBindings once the page loaded to activate them.

@sophiebits
Copy link
Collaborator Author

Got it – thanks for the explanation! I don't think this will be an issue for us.

* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactSimpleEmptyComponent
Copy link
Member

Choose a reason for hiding this comment

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

You don't use this anywhere… is the thinking that this would be used in RN?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah. (I even mentioned that in my PR description. ;))

sophiebits added a commit that referenced this pull request Nov 20, 2015
Use comment nodes for empty components
@sophiebits sophiebits merged commit 907dee2 into facebook:master Nov 20, 2015
@zpao
Copy link
Member

zpao commented Nov 20, 2015

doit

@martijnrusschen
Copy link

Interesting! Would really like to use this, but it looks like this code hasn't been released yet. Any idea why this will be released?

@jimfb
Copy link
Contributor

jimfb commented Feb 22, 2016

@martijnrusschen This will be released in v15, coming soon.

@martijnrusschen
Copy link

👍

@alxndr
Copy link

alxndr commented Oct 11, 2016

Should this mean that React can render <noscript> elements normally, without the need for workarounds like what powers the react-noscript package?

@sophiebits
Copy link
Collaborator Author

@alxndr That's unrelated, sorry.

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.

8 participants