public static class HTMLElements.HTMLElementsWithCache extends Object implements HTMLElementsProvider
HTMLElementsProvider that wraps an HTMLElements
instance and adds a simple cache for unknown element lookups.
This class is optimized for repeated element name lookups, especially for names that are not present in the known elements set. It avoids repeated lowercasing and unnecessary lookups for unknown elements by caching misses.
This implementation is not thread-safe.
| Constructor and Description |
|---|
HTMLElementsWithCache(HTMLElements htmlElements) |
| Modifier and Type | Method and Description |
|---|---|
HTMLElements.Element |
getElement(String ename) |
HTMLElements.Element |
getElement(String ename,
HTMLElements.Element elementIfNotFound) |
HTMLElements.Element |
getElementLC(String enameLC,
HTMLElements.Element elementIfNotFound) |
public HTMLElementsWithCache(HTMLElements htmlElements)
public HTMLElements.Element getElement(String ename)
getElement in interface HTMLElementsProviderename - the element name.public HTMLElements.Element getElement(String ename, HTMLElements.Element elementIfNotFound)
getElement in interface HTMLElementsProviderename - the element name.elementIfNotFound - the default element to return if not found.public HTMLElements.Element getElementLC(String enameLC, HTMLElements.Element elementIfNotFound)
getElementLC in interface HTMLElementsProviderenameLC - the element name in lower caseelementIfNotFound - the default element to return if not found.Copyright © 2025 HtmlUnit. All rights reserved.