Microsoft/TypeScript

Wrong createElementNS() type definitions

已关闭

#24,269 创建于 2018年5月19日

 (5 条评论) (0 个反应) (0 位负责人)TypeScript (13,395 个派生)batch import
BugDomain: lib.d.tsHelp Wanted

仓库指标

星标
 (108,860 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Document.createElementNS() allows to create a few nonexistent SVG elements. In particular, this function has signatures that allow creating componentTransferFunction, textContent and textPositioning, but these correspond to SVG interfaces which do not have any real element associated.

This can be easily verified by running:

document.createElementNS('http://www.w3.org/2000/svg', 'textContent') instanceof SVGTextElement; // false
document.createElementNS('http://www.w3.org/2000/svg', 'text') instanceof SVGTextElement; // true

(Note that SVGTextElement implements SVGTextContentElement.)

贡献者指南