Skip to content

Input elements shouldn't have children #871

Closed

Description

@jhsware

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

Activity

  1. TheSharpieOne commented on Feb 27, 2018

    @TheSharpieOne
    Member

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

  2. jhsware commented on Feb 27, 2018

    @jhsware
    Author

    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.

  3. TheSharpieOne commented on Feb 27, 2018

    @TheSharpieOne
    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).

  4. jhsware commented on Feb 27, 2018

    @jhsware
    Author

    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.

  5. TheSharpieOne commented on Feb 27, 2018

    @TheSharpieOne
    Member

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

  6. jhsware commented on Feb 27, 2018

    @jhsware
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions