Microsoft/TypeScript

Wrong createElementNS() type definitions

クローズ

#24,269 opened on 2018/05/19

 (5 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (13,395 件のフォーク)batch import
BugDomain: lib.d.tsHelp Wanted

Repository metrics

Stars
 (108,860 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド