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

Stop passing null as second argument to document.createElement() #6896

Merged
merged 2 commits into from May 26, 2016

Conversation

Projects
None yet
3 participants
@darobin
Copy link
Contributor

commented May 26, 2016

When using the two-parameter variant of document.createElement() (which is used for Custom Elements), if null is passed as the second parameter then Firefox will stringify it to the DOM as an is="null" attribute. I don't believe that this causes any manner of problem, but it is surprising (as exemplified in this discussion thread.

This change simply changes the call to avoid passing null.

@gaearon

This comment has been minimized.

Copy link
Member

commented May 26, 2016

Can we just always pass props.is? It would be undefined unless specified, which is indistinguishable from not passing it at all.

cc @jimfb

@darobin

This comment has been minimized.

Copy link
Contributor Author

commented May 26, 2016

I tried that, it was my first guess: Firefox helpfully gives you is="undefined" in return.

@gaearon

This comment has been minimized.

Copy link
Member

commented May 26, 2016

Haha, got it. Let’s split into two branches to make it a bit easier on eyes?

} else if (props.is) {
  ...
} else {
  ...
}
@darobin

This comment has been minimized.

Copy link
Contributor Author

commented May 26, 2016

Sure thing, done.

@gaearon

This comment has been minimized.

Copy link
Member

commented May 26, 2016

Is there any way to test this with jsdom so we don’t regress?

@ghost

This comment has been minimized.

Copy link

commented May 26, 2016

@darobin updated the pull request.

@darobin

This comment has been minimized.

Copy link
Contributor Author

commented May 26, 2016

Not that I can think of, at least not without intercepting createElement, which is doable but perhaps a bit brutal. Note that Firefox's behaviour is incorrect as per (current) spec, and therefore likely to change at some point.

@gaearon gaearon merged commit 2636155 into facebook:master May 26, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@gaearon

This comment has been minimized.

Copy link
Member

commented May 26, 2016

Thanks!

@zpao

This comment has been minimized.

Copy link
Member

commented May 27, 2016

Do you know if this Firefox bug been reported to Mozilla?

@zpao zpao added this to the 15.y.z milestone May 27, 2016

@darobin

This comment has been minimized.

Copy link
Contributor Author

commented May 27, 2016

Yes, I discussed it on #whatwg this morning to double-check, and reported it in bugzilla.

@targos targos referenced this pull request May 29, 2016

Closed

Notify new commits on a PR ? #46

@nfcampos nfcampos referenced this pull request Jun 6, 2016

Merged

running tests with karma #421

7 of 7 tasks complete

zpao added a commit to zpao/react that referenced this pull request Jun 8, 2016

Stop passing null as second argument to document.createElement() (fac…
…ebook#6896)

* Stop passing null as second argument to document.createElement()

* rewrap check for props.is to make it more readable

(cherry picked from commit 2636155)

zpao added a commit that referenced this pull request Jun 14, 2016

Stop passing null as second argument to document.createElement() (#6896)
* Stop passing null as second argument to document.createElement()

* rewrap check for props.is to make it more readable

(cherry picked from commit 2636155)

@zpao zpao modified the milestones: 15-next, 15.2.0 Jun 14, 2016

@zpao zpao removed this from the 15-next milestone Jun 14, 2016

@renovate renovate bot referenced this pull request Feb 2, 2018

Open

Update dependency react to v0.14.9 #29

0 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.