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

componentWillMount with .getDOMNode() that isn't in document yet #2784

Closed
Gozala opened this issue Dec 29, 2014 · 3 comments
Closed

componentWillMount with .getDOMNode() that isn't in document yet #2784

Gozala opened this issue Dec 29, 2014 · 3 comments

Comments

@Gozala
Copy link

Gozala commented Dec 29, 2014

Currently there is no hook that would allow us to set attributes on the node before it's injected into a document. Which is unfortunate as there are some attributes in the wild that take effect only before element is injected into a document.

To workaround this I'm forced to replacing react injected nodes with clones on componentDidMount
https://github.com/Gozala/firefox.html/blob/react/js/element.js#L57-L61

It would be great if react could expose node that will be inserted during componentWillMount or added another hook where node will be provided.

@zpao
Copy link
Member

zpao commented Dec 29, 2014

Since we're using innerHTML and building up a string as we go, that's not currently possible. If we switched to using createElement it would be, but I think we'd like to keep that an implementation detail so we could conditionally switch (eg, it might be better to use createElement in modern Firefox but innerHTML in IE8).

I think the better solution will be to make sure our attribute support is more versatile.

@jimfb
Copy link
Contributor

jimfb commented Jan 3, 2015

Which attributes need to be set before element injection in order to take effect?

Also, is the underlying issue that React doesn't let you set unknown/unrecognized attributes? If so, perhaps this is a duplicate of #2746

@sophiebits
Copy link
Collaborator

Closing due to inactivity, but we can discuss more if you still have an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants