From fa6205d522a9d3e3f228be18dd29f11f8930c394 Mon Sep 17 00:00:00 2001 From: Brandon Dail Date: Tue, 12 Feb 2019 20:13:17 -0800 Subject: [PATCH] Special case crossOrigin for SVG image elements (#14832) --- packages/react-dom/src/shared/DOMProperty.js | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/react-dom/src/shared/DOMProperty.js b/packages/react-dom/src/shared/DOMProperty.js index f049205d19..3dd08203d4 100644 --- a/packages/react-dom/src/shared/DOMProperty.js +++ b/packages/react-dom/src/shared/DOMProperty.js @@ -525,13 +525,15 @@ const capitalize = token => token[1].toUpperCase(); ); }); -// Special case: this attribute exists both in HTML and SVG. -// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use -// its React `tabIndex` name, like we do for attributes that exist only in HTML. -properties.tabIndex = new PropertyInfoRecord( - 'tabIndex', - STRING, - false, // mustUseProperty - 'tabindex', // attributeName - null, // attributeNamespace -); +// These attribute exists both in HTML and SVG. +// The attribute name is case-sensitive in SVG so we can't just use +// the React name like we do for attributes that exist only in HTML. +['tabIndex', 'crossOrigin'].forEach(attributeName => { + properties[attributeName] = new PropertyInfoRecord( + attributeName, + STRING, + false, // mustUseProperty + attributeName.toLowerCase(), // attributeName + null, // attributeNamespace + ); +});