Skip to content

Inefficient internal content(Element) method #151

@lukaseder

Description

@lukaseder

There's an internal content(Element) method with a TODO that does not yet have an issue associated with it:

// TODO: Check this code's efficiency
String name = element.getTagName();
return Util.toString(element).replaceAll("(?s)^<" + name + "(?:[^>]*)>(.*)</" + name + ">$", "$1");

This is very obviously inefficient. We cannot cache the regular expression, but we can traverse the string without resorting to regexes, as the regex logic is rather simple.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions