Skip to content

Work with jsdom without global values #137

@vilicvane

Description

@vilicvane

Trying to use diff-dom in non-test Node.js project with jsdom, I noticed the document option that allows manually specifying the value, but that option along does not work.

The issue is caused by DiffFInder doing a global typeof Element check that prevents the expected nodeToObj() conversion:

https://github.com/fiduswriter/diffDOM/blob/8f19b20a5e8e1f8d1db488a8b9e26e1fc745ec34/src/diffDOM/virtual/diff.ts#L42C1-L43

Workaround:

dd.diff(nodeToObj(elementA), nodeToObj(elementB));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions