Skip to content

Document that $('.foo').append(document.createTextNode('bar')) is a supported use case #879

@stanvass

Description

@stanvass

The documentation says append() accepts:

  • string
  • Element
  • jQuery collection

The problem is there's no official way to append a text node in jQuery. Using append() with a text node works just fine, but Text is not an instance of Element, it's an instance of its parent prototype, Node.

The way this is documented echoes in other tools and definitions like Definitely Typed's jQuery TypeScript .d.ts definition, where the TypeScript compiler throws an error when I'm appending a text node.

Please fix this in the documentation so it can trickle downstream into our tooling. Thanks :-)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions