-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Don't set children attribute on SVG nodes #6164
Conversation
@@ -912,20 +914,21 @@ ReactDOMComponent.Mixin = { | |||
deleteListener(this, propKey); | |||
} | |||
} else if (isCustomComponent(this._tag, nextProps)) { | |||
if (propKey === CHILDREN) { | |||
nextProp = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure what is the point of setting nextProp
to null
here. It caused removeAttribute()
call but it’s not like this attribute existed in the first place? Since this didn’t break any tests (:wink::wink:), I just put it behind an if
.
This is similar to #5093 so I would appreciate if @jimfb, @zpao and @sebmarkbage could also take a look. I can remove the change to web component code and keep it as |
We probably also want to skip dangerouslySetInnerHTML. Maybe suppressContentEditableWarning too now that we invented that… |
Maybe just add a list/object at the top with those keys to skip over? Otherwise this seems good. |
@spicyj I added an object. |
).toBe(false); | ||
}); | ||
|
||
it('should skip dangerouslySetInnerHTML on web components', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made this a separate test because can’t check children
and dangerouslySetInnerHTML
at the same time.
@gaearon updated the pull request. |
1 similar comment
@gaearon updated the pull request. |
var STYLE = keyOf({style: null}); | ||
var HTML = keyOf({__html: null}); | ||
var RESERVED_PROPS = keyMirror({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for keyMirror since we're not using the values.
(Otherwise looks great.) |
@gaearon updated the pull request. |
Don't set children attribute on SVG nodes
if (propKey === CHILDREN) { | ||
nextProp = null; | ||
if (!RESERVED_PROPS.hasOwnProperty(propKey)) { | ||
DOMPropertyOperations.setValueForAttribute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaearon this implementation doesn't allow to pass values other than strings to a custom element. How do I pass an array, object or function?
This fixes a bug introduced in #5714.
Closes #6165 (yes, an issue from the future, I know!)
The code paths are now similar to web components where we work around the same issue (#5093).
Reviewers: @spicyj