Skip to content

Instantly share code, notes, and snippets.

@akre54
Last active November 23, 2015 18:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save akre54/80eaa63762ea499029f0 to your computer and use it in GitHub Desktop.
Save akre54/80eaa63762ea499029f0 to your computer and use it in GitHub Desktop.
React SVG element monkeypatch
ReactDOM = require 'react/lib/ReactDOM'
ReactElement = require 'react/lib/ReactElement'
ReactElementValidator = require 'react/lib/ReactElementValidator'
SVGDOMPropertyConfig = require 'react/lib/SVGDOMPropertyConfig'
MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE
createFactory = if __DEV__
ReactElementValidator.createFactory
else
ReactElement.createFactory
SVGDOMPropertyConfig.Properties.mask = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.filter = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.stdDeviation = MUST_USE_ATTRIBUTE
ReactDOM.filter = createFactory 'filter'
ReactDOM.feGaussianBlur = createFactory 'feGaussianBlur'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment