-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Add support for SVG tspan and image elements, and the preserveAspectRatio attribute #830
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,7 @@ var DefaultDOMPropertyConfig = { | |
gradientUnits: MUST_USE_ATTRIBUTE, | ||
offset: MUST_USE_ATTRIBUTE, | ||
points: MUST_USE_ATTRIBUTE, | ||
preserveAspectRatio: MUST_USE_ATTRIBUTE, | ||
r: MUST_USE_ATTRIBUTE, | ||
rx: MUST_USE_ATTRIBUTE, | ||
ry: MUST_USE_ATTRIBUTE, | ||
|
@@ -144,6 +145,8 @@ var DefaultDOMPropertyConfig = { | |
transform: MUST_USE_ATTRIBUTE, | ||
version: MUST_USE_ATTRIBUTE, | ||
viewBox: MUST_USE_ATTRIBUTE, | ||
xlinkNamespace: MUST_USE_ATTRIBUTE, | ||
xlinkHref: MUST_USE_ATTRIBUTE, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... I don't think this works. If React tries to change the values, it would have to use
Support for namespaced attributes in general has not really been tested. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm you may be right, I only tested that it properly creates the image in the first place -- didn't try changing the value once it was rendered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ericflo Any update on namespaced attributes, did they work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't gotten a chance to work on it. In fact, I ran into enough issues with SVGs that I had to actually just bypass React for now for this part of the project I'm working on. |
||
x1: MUST_USE_ATTRIBUTE, | ||
x2: MUST_USE_ATTRIBUTE, | ||
x: MUST_USE_ATTRIBUTE, | ||
|
@@ -161,7 +164,9 @@ var DefaultDOMPropertyConfig = { | |
stopOpacity: 'stop-opacity', | ||
strokeLinecap: 'stroke-linecap', | ||
strokeWidth: 'stroke-width', | ||
viewBox: 'viewBox' | ||
viewBox: 'viewBox', | ||
xlinkNamespace: 'xmlns:xlink', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not xmlnsXlink? xlinkNamespace seems like a weird name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to change it to xmlnsXlink if that's better. |
||
xlinkHref: 'xlink:href' | ||
}, | ||
DOMPropertyNames: { | ||
autoCapitalize: 'autocapitalize', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,8 @@ var shouldWrap = { | |
'radialGradient': true, | ||
'rect': true, | ||
'stop': true, | ||
'text': true | ||
'text': true, | ||
'tspan': true | ||
}; | ||
|
||
var selectWrap = [1, '<select multiple="true">', '</select>']; | ||
|
@@ -79,6 +80,7 @@ var markupWrap = { | |
'circle': svgWrap, | ||
'defs': svgWrap, | ||
'g': svgWrap, | ||
'image': svgWrap, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should |
||
'line': svgWrap, | ||
'linearGradient': svgWrap, | ||
'path': svgWrap, | ||
|
@@ -87,7 +89,8 @@ var markupWrap = { | |
'radialGradient': svgWrap, | ||
'rect': svgWrap, | ||
'stop': svgWrap, | ||
'text': svgWrap | ||
'text': svgWrap, | ||
'tspan': svgWrap | ||
}; | ||
|
||
/** | ||
|
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.
Alphabetical ordering?