Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to rename an Element's Tag without resetting the tag's properties #1980

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ThoughtProcess
Copy link

This PR is tangentially related to #1428 and #502.

If I want to change the name of an element's tag as I traverse the DOM, I don't have the ability to "preserve" the properties of the underlying Tag object (for example, keeping a tag as self-closing). A great example of this is renaming a JSP tag, where I might want to change a <bean:message /> to a <spring:message />.

This PR adds a new method to the Element class, renameTagPreserveProperties(String), to support that behavior. Also added unit tests to confirm that the behavior of the Element.tagName(String) method is preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant