Skip to content

Cloning an element with attributes creates an empty userData attribute #2356

@leomayer

Description

@leomayer

We have in our tests the following element

<span id="test"></span>

In our code base we check if an element has no attribute except id. This is checked by the following code

e.clone()
	.removeAttr("id")
	.attributes()
	.isEmpty()

With 1.20.1 this return true while 1.21.1 this returns false. Somehow there is still a single attribute left. I would guess it has to do with the clone but I'm not sure.

I just report it but I'm aware that there is better method for checking, e.g.

e.attributes().size()==1 & e.attributes.hasKey("id")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA confirmed bug, that we should fix

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions