Skip to content

Remove documentFragment or separate it from HtmlDomNode #1618

@ylemkimon

Description

@ylemkimon

documentFragment causes many problems because they differ from normal HtmlDomNode, but it implements HtmlDomNode.

#1471 (comment) by @edemaine

This seems fine, and simpler to me, but I'll reraise a question I asked in #1439 (comment):

The one scary thing might be someone doing myDocumentFragment.classes.push('something'), which will then act as a no-op...

I think the real issue here is we're abusing the type interface. But this was true before, too. Perhaps the proper way would be to have two interfaces, one with style and one without (the former could subclass from the latter). We could save this change for another PR if you prefer.

#1486 (review)

https://github.com/Khan/KaTeX/blob/536eb9f3dc68503129515600de9486e09700039c/src/functions/href.js#L34-L35

assumes buildExpressionRow returning a documentFragment.

There are many other instances of assigning a class, a style, or an attribute to documentFragment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions