Skip to content

key option prefixes incorrectly #110

@stevenvachon

Description

@stevenvachon
const div = document.createElement('div');
div.innerHTML = `text1 text2`;
Splitting({ by: 'words', key: 'yeah', target: div });
console.log(div.outerHTML);

produces:

<div class=\"words splitting\" style=\"---yeahword-total: 2;\"><span class=\"word\" data-word=\"text1\" style=\"---yeahword-index: 0;\">text1</span><span class=\"whitespace\"> </span><span class=\"word\" data-word=\"text2\" style=\"---yeahword-index: 1;\">text2</span></div>

when it should instead produce:

<div class=\"words splitting\" style=\"--yeah-word-total: 2;\"><span class=\"word\" data-word=\"text1\" style=\"--yeah-word-index: 0;\">text1</span><span class=\"whitespace\"> </span><span class=\"word\" data-word=\"text2\" style=\"--yeah-word-index: 1;\">text2</span></div>

It happens with by: 'chars' too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions