Skip to content

Commit

Permalink
fix page index
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Nov 24, 2024
1 parent e7c7033 commit 43ec32b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/org/htmlunit/html/HtmlPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1743,12 +1743,7 @@ public List<DomElement> getElementsByIdAndOrName(final String idAndOrName) {
*/
void notifyNodeAdded(final DomNode node) {
if (node instanceof DomElement) {
final DomElement element = (DomElement) node;

if (ATTRIBUTE_NOT_DEFINED != element.getAttribute(DomElement.NAME_ATTRIBUTE)
|| ATTRIBUTE_NOT_DEFINED != element.getAttribute(DomElement.ID_ATTRIBUTE)) {
addMappedElement((DomElement) node, true);
}
addMappedElement((DomElement) node, true);

if (node instanceof BaseFrameElement) {
frameElements_.add((BaseFrameElement) node);
Expand Down Expand Up @@ -1868,6 +1863,17 @@ private void removeElement(final Map<String, MappedElementIndexEntry> map, final
}
}

/**
* Indicates if the attribute name indicates that the owning element is mapped.
* @param document the owning document
* @param attributeName the name of the attribute to consider
* @return {@code true} if the owning element should be mapped in its owning page
*/
static boolean isMappedElement(final Document document, final String attributeName) {
return document instanceof HtmlPage
&& (DomElement.NAME_ATTRIBUTE.equals(attributeName) || DomElement.ID_ATTRIBUTE.equals(attributeName));
}

private void calculateBase() {
final List<HtmlElement> baseElements = getDocumentElement().getStaticElementsByTagName("base");

Expand Down

0 comments on commit 43ec32b

Please sign in to comment.