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

Mutating element attributes leaves behind empty ones #1722

Closed
ghost opened this issue Jun 19, 2014 · 1 comment
Closed

Mutating element attributes leaves behind empty ones #1722

ghost opened this issue Jun 19, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 19, 2014

I have links that I'm writing out where if they're disabled I'm leaving the href as undefined:

    render: function() {
        var href = this.props.disabled ? undefined : this.props.url;
        return <a href={href}>{this.props.title}</a>;
    }

When this first renders (disabled) the HTML DOM I get looks like this:

<a>Foo</a>

When the state changes and it's re-rendered enabled it looks like this:

<a href="#/hello">Foo</a>

All good so far, however if it then disables again, the href attribute is left in with no value:

<a href >Foo</a>

This means it still gets the styles for being a link and will receive focus.

For me it should be consistent for both disabled states.

@sophiebits
Copy link
Contributor

(Closing in favor of #1448.)

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

1 participant