diff --git a/HTMLKit/HTMLElementAdjustment.h b/HTMLKit/HTMLElementAdjustment.h
index 9702469..d2ba784 100644
--- a/HTMLKit/HTMLElementAdjustment.h
+++ b/HTMLKit/HTMLElementAdjustment.h
@@ -87,3 +87,48 @@ NS_INLINE void AdjustSVGAttributes(HTMLTagToken *token)
}
token.attributes = adjusted;
}
+
+NS_INLINE void AdjustSVGNameCase(HTMLTagToken *token)
+{
+ NSDictionary *replacements = @{
+ @"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"};
+
+ NSString *replacement = replacements[token.tagName] ?: token.tagName;
+ token.tagName = replacement;
+}
diff --git a/HTMLKit/HTMLParser.m b/HTMLKit/HTMLParser.m
index 7a1faaf..1106c52 100644
--- a/HTMLKit/HTMLParser.m
+++ b/HTMLKit/HTMLParser.m
@@ -2337,6 +2337,7 @@
AdjustMathMLAttributes(token.asTagToken);
}
if (self.adjustedCurrentNode.namespace == HTMLNamespaceSVG) {
+ AdjustSVGNameCase(token.asTagToken);
AdjustSVGAttributes(token.asTagToken);
}
// "Adjust foreign attributes": Attributes' namespace ignored