Skip to content

Instantly share code, notes, and snippets.

@kulicuu
Forked from akre54/react-svg-patch.coffee
Last active November 26, 2015 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kulicuu/d24e1a59a837288fe7af to your computer and use it in GitHub Desktop.
Save kulicuu/d24e1a59a837288fe7af to your computer and use it in GitHub Desktop.
#----------------------------------------------
# monkey patch, original from
# https://gist.github.com/akre54/80eaa63762ea499029f0
# this one edited
# this one works with React version 0.14.0-beta1 but NOT work with 0.14.3.
# no other versions tested
c = -> console.log.apply console, arguments
ReactDOM = require 'react/lib/ReactDOM'
ReactElement = require 'react/lib/ReactElement'
ReactElementValidator = require 'react/lib/ReactElementValidator'
SVGDOMPropertyConfig = require 'react/lib/SVGDOMPropertyConfig'
DOMProperty = require 'react/lib/DOMProperty'
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
SVGDOMPropertyConfig.Properties.result = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.mode = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.in = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.in2 = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.x = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.y = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.rx = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.ry = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.dx = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.dy = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.cursor = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.textLength = MUST_USE_ATTRIBUTE
SVGDOMPropertyConfig.Properties.lengthAdjust = MUST_USE_ATTRIBUTE
ReactDOM.filter = createFactory 'filter'
ReactDOM.feGaussianBlur = createFactory 'feGaussianBlur'
ReactDOM.feBlend = createFactory 'feBlend'
ReactDOM.feOffset = createFactory 'feOffset'
ReactDOM.feMerge = createFactory 'feMerge'
ReactDOM.feMergeNode = createFactory 'feMergeNode'
ReactDOM.foreignObject = createFactory 'foreignObject'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment