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

Input elements shouldn't have children #871

Closed
jhsware opened this issue Feb 27, 2018 · 6 comments
Closed

Input elements shouldn't have children #871

jhsware opened this issue Feb 27, 2018 · 6 comments

Comments

@jhsware
Copy link

jhsware commented Feb 27, 2018

it('should render children', () => {

@TheSharpieOne
Copy link
Member

TheSharpieOne commented Feb 27, 2018

They should when the "input" is a <select> or <textarea>, which the Input component can render given type="select" or type="textarea" respectfully.

@jhsware
Copy link
Author

jhsware commented Feb 27, 2018

The default input type is text so the test should be something like this: <Input type="select">Yo!</Input>

Are you sure type="textarea" is allowed children? The React-clone Inferno.js complains if textarea has children.

@TheSharpieOne
Copy link
Member

Sounds like a defect for inferno. <textarea> is not a void element, it allows content within it. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea

Yes, the test itself probably could use type="textarea", but we don't check the type to determine if it can have children (we probably should, it would be simple since we use the type to determine the tag and if the tag is input, we should not allow children).

@jhsware
Copy link
Author

jhsware commented Feb 27, 2018

React doesn't follow HTML-specs in that regard: https://reactjs.org/docs/forms.html

<textarea value={this.state.value} onChange={this.handleChange} />

Only <select> should have children from what I can tell.

@TheSharpieOne
Copy link
Member

Yeah, looks like they are removing the ability for <textarea>s to have children in react 17: facebook/react#11639

@jhsware
Copy link
Author

jhsware commented Feb 27, 2018

I have made a port of Reactstrap to Inferno.js so I get stuck in the middle at times... :D

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

No branches or pull requests

2 participants