+adp_els = { address: NS_HTML, div: NS_HTML, p: NS_HTML }
+el_is_special_not_adp = (el) ->
+ return special_elements[el.name] is el.namespace and adp_els[el.name] isnt el.namespace
+
+svg_name_fixes = {
+ altglyph: 'altGlyph'
+ altglyphdef: 'altGlyphDef'
+ altglyphitem: 'altGlyphItem'
+ animatecolor: 'animateColor'
+ animatemotion: 'animateMotion'
+ animatetransform: 'animateTransform'
+ clippath: 'clipPath'
+ feblend: 'feBlend'
+ fecolormatrix: 'feColorMatrix'
+ fecomponenttransfer: 'feComponentTransfer'
+ fecomposite: 'feComposite'
+ feconvolvematrix: 'feConvolveMatrix'
+ fediffuselighting: 'feDiffuseLighting'
+ fedisplacementmap: 'feDisplacementMap'
+ fedistantlight: 'feDistantLight'
+ fedropshadow: 'feDropShadow'
+ feflood: 'feFlood'
+ fefunca: 'feFuncA'
+ fefuncb: 'feFuncB'
+ fefuncg: 'feFuncG'
+ fefuncr: 'feFuncR'
+ fegaussianblur: 'feGaussianBlur'
+ feimage: 'feImage'
+ femerge: 'feMerge'
+ femergenode: 'feMergeNode'
+ femorphology: 'feMorphology'
+ feoffset: 'feOffset'
+ fepointlight: 'fePointLight'
+ fespecularlighting: 'feSpecularLighting'
+ fespotlight: 'feSpotLight'
+ fetile: 'feTile'
+ feturbulence: 'feTurbulence'
+ foreignobject: 'foreignObject'
+ glyphref: 'glyphRef'
+ lineargradient: 'linearGradient'
+ radialgradient: 'radialGradient'
+ textpath: 'textPath'
+}
+svg_attribute_fixes = {
+ attributename: 'attributeName'
+ attributetype: 'attributeType'
+ basefrequency: 'baseFrequency'
+ baseprofile: 'baseProfile'
+ calcmode: 'calcMode'
+ clippathunits: 'clipPathUnits'
+ contentscripttype: 'contentScriptType'
+ contentstyletype: 'contentStyleType'
+ diffuseconstant: 'diffuseConstant'
+ edgemode: 'edgeMode'
+ externalresourcesrequired: 'externalResourcesRequired'
+ # WHATWG removes this: filterres: 'filterRes'
+ filterunits: 'filterUnits'
+ glyphref: 'glyphRef'
+ gradienttransform: 'gradientTransform'
+ gradientunits: 'gradientUnits'
+ kernelmatrix: 'kernelMatrix'
+ kernelunitlength: 'kernelUnitLength'
+ keypoints: 'keyPoints'
+ keysplines: 'keySplines'
+ keytimes: 'keyTimes'
+ lengthadjust: 'lengthAdjust'
+ limitingconeangle: 'limitingConeAngle'
+ markerheight: 'markerHeight'
+ markerunits: 'markerUnits'
+ markerwidth: 'markerWidth'
+ maskcontentunits: 'maskContentUnits'
+ maskunits: 'maskUnits'
+ numoctaves: 'numOctaves'
+ pathlength: 'pathLength'
+ patterncontentunits: 'patternContentUnits'
+ patterntransform: 'patternTransform'
+ patternunits: 'patternUnits'
+ pointsatx: 'pointsAtX'
+ pointsaty: 'pointsAtY'
+ pointsatz: 'pointsAtZ'
+ preservealpha: 'preserveAlpha'
+ preserveaspectratio: 'preserveAspectRatio'
+ primitiveunits: 'primitiveUnits'
+ refx: 'refX'
+ refy: 'refY'
+ repeatcount: 'repeatCount'
+ repeatdur: 'repeatDur'
+ requiredextensions: 'requiredExtensions'
+ requiredfeatures: 'requiredFeatures'
+ specularconstant: 'specularConstant'
+ specularexponent: 'specularExponent'
+ spreadmethod: 'spreadMethod'
+ startoffset: 'startOffset'
+ stddeviation: 'stdDeviation'
+ stitchtiles: 'stitchTiles'
+ surfacescale: 'surfaceScale'
+ systemlanguage: 'systemLanguage'
+ tablevalues: 'tableValues'
+ targetx: 'targetX'
+ targety: 'targetY'
+ textlength: 'textLength'
+ viewbox: 'viewBox'
+ viewtarget: 'viewTarget'
+ xchannelselector: 'xChannelSelector'
+ ychannelselector: 'yChannelSelector'
+ zoomandpan: 'zoomAndPan'
+}
+foreign_attr_fixes = {
+ 'xlink:actuate': 'xlink actuate'
+ 'xlink:arcrole': 'xlink arcrole'
+ 'xlink:href': 'xlink href'
+ 'xlink:role': 'xlink role'
+ 'xlink:show': 'xlink show'
+ 'xlink:title': 'xlink title'
+ 'xlink:type': 'xlink type'
+ 'xml:base': 'xml base'
+ 'xml:lang': 'xml lang'
+ 'xml:space': 'xml space'
+ 'xmlns': 'xmlns'
+ 'xmlns:xlink': 'xmlns xlink'
+}
+adjust_mathml_attributes = (t) ->
+ for a in t.attrs_a
+ if a[0] is 'definitionurl'
+ a[0] = 'definitionURL'
+ return
+adjust_svg_attributes = (t) ->
+ for a in t.attrs_a
+ if svg_attribute_fixes[a[0]]?
+ a[0] = svg_attribute_fixes[a[0]]
+ return
+adjust_foreign_attributes = (t) ->
+ # fixfull
+ for a in t.attrs_a
+ if foreign_attr_fixes[a[0]]?
+ a[0] = foreign_attr_fixes[a[0]]
+ return
+