Microsoft/TypeScript

Wrong createElementNS() type definitions

Fermée

#24 269 ouverte le 19 mai 2018

 (5 commentaires) (0 réaction) (0 personne assignée)TypeScript (13 395 forks)batch import
BugDomain: lib.d.tsHelp Wanted

Métriques du dépôt

Stars
 (108 860 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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

Guide contributeur