Skip to content

Prepend and after are inconsistent #35

@marcelerz

Description

@marcelerz

When having following code:

var morph = Metamorph('foo');

Which results in the following markup:

...
<script id="metamorph-0-start" type="text/x-placeholder"></script>
foo
<script id="metamorph-0-end" type="text/x-placeholder"></script>
...

When we call after() on the Metamorph instance:

morph.after("bar");

We get this:

...
<script id="metamorph-0-start" type="text/x-placeholder"></script>
foo
<script id="metamorph-0-end" type="text/x-placeholder"></script>
bar
...

The innerHTML is not changed as it is injected after the script-tag.

And when we call prepend() on the Metamorph instance:

morph.prepend("bar");

We get this:

...
<script id="metamorph-0-start" type="text/x-placeholder"></script>
bar
foo
<script id="metamorph-0-end" type="text/x-placeholder"></script>
...

However, the innerHTML is here not modified even though it changed the content between the script-tags, giving incorrect data when innerHTML is requested.

Should there also be a before() and append() function? (I don't mean appendTo() here.)

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