Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElementTagNameMap has wrong case for camelCase SVG elements #21450

Closed
HolgerJeromin opened this issue Jan 29, 2018 · 2 comments
Closed

ElementTagNameMap has wrong case for camelCase SVG elements #21450

HolgerJeromin opened this issue Jan 29, 2018 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@HolgerJeromin
Copy link
Contributor

TypeScript Version: master

Code

var svgEle = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
var linGrad = document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient');
svgEle.appendChild(linGrad);

// typescript SVGLinearGradientElement, Browser null (Tested with Chrome and IE11)
var resultNull = svgEle.querySelector('lineargradient'); 

// typescript Element,  Browser SVGLinearGradientElement
var resultOk = svgEle.querySelector('linearGradient'); 

Expected behavior:
.querySelector('linearGradient')
should return a SVGLinearGradientElement

Actual behavior:
The *TagNameMap maps the wrong case to the SvgElement type
https://github.com/Microsoft/TypeScript/blob/02e79849ef7259a1985391d85faea1cd6d86c3d0/lib/lib.d.ts#L19129

Probably effected:
clipPath, componentTransferFunction, feBlend, feColorMatrix, feComponentTransfer, feComposite, feConvolveMatrix, feDiffuseLighting, feDisplacementMap, feDistantLight, feFlood, feFuncA, feFuncB, feFuncG, feFuncR, feGaussianBlur, feImage, feMerge, feMergeNode, feMorphology, feOffset, fePointLight, feSpecularLighting, feSpotLight, feTile, feTurbulence, foreignObject, linearGradient, radialGradient, textContent, textPath, textPositioning

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Jan 29, 2018
@mhegazy mhegazy added this to the Community milestone Jan 30, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jan 30, 2018

PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.

@variousauthors
Copy link

variousauthors commented Feb 1, 2018

It appears that all of the entries in the SVGElementTagNameMap interface are lowercase, rather than camelcase, where as in the spec they are camelcase. There was an issue regarding the camelcase svg tags in the w3c repo that may shed some insight into this issue: w3c/svgwg#161

It looks like the tagnames are case insensitive, so you can use <linearGradient> or <lineargradient> and it will be fine, but the methods are case sensitive?

@mhegazy mhegazy added the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label Apr 5, 2018
@mhegazy mhegazy self-assigned this Apr 5, 2018
@mhegazy mhegazy modified the milestones: Community, TypeScript 2.9 Apr 5, 2018
@mhegazy mhegazy modified the milestones: TypeScript 2.9, TypeScript 3.0 May 8, 2018
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet labels Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

4 participants