Microsoft/TypeScript

Wrong createElementNS() type definitions

Open

#24,269 建立於 2018年5月19日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)TypeScript (48,455 star) (6,726 fork)batch import
BugDomain: lib.d.tsHelp Wanted

描述

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.)

貢獻者指南