MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / detach

Method detach

src/main/java/org/htmlunit/html/HtmlElement.java:1329–1366  ·  view source on GitHub ↗

INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. Detach this node from all relationships with other nodes. This is the first step of a move.

()

Source from the content-addressed store, hash-verified

1327 * This is the first step of a move.
1328 */
1329 @Override
1330 protected void detach() {
1331 final SgmlPage page = getPage();
1332 if (!page.getWebClient().isJavaScriptEngineEnabled()) {
1333 super.detach();
1334 return;
1335 }
1336
1337 final HtmlUnitScriptable document = page.getScriptableObject();
1338
1339 if (document instanceof HTMLDocument doc) {
1340 final Object activeElement = doc.getActiveElement();
1341
1342 if (activeElement == getScriptableObject()) {
1343 if (hasFeature(HTMLELEMENT_REMOVE_ACTIVE_TRIGGERS_BLUR_EVENT)) {
1344 ((HtmlPage) page).setFocusedElement(null);
1345 }
1346 else {
1347 ((HtmlPage) page).setElementWithFocus(null);
1348 }
1349 }
1350 else {
1351 for (final DomNode child : getChildNodes()) {
1352 if (activeElement == child.getScriptableObject()) {
1353 if (hasFeature(HTMLELEMENT_REMOVE_ACTIVE_TRIGGERS_BLUR_EVENT)) {
1354 ((HtmlPage) page).setFocusedElement(null);
1355 }
1356 else {
1357 ((HtmlPage) page).setElementWithFocus(null);
1358 }
1359
1360 break;
1361 }
1362 }
1363 }
1364 }
1365 super.detach();
1366 }
1367
1368 /**
1369 * {@inheritDoc}

Callers

nothing calls this directly

Calls 9

getWebClientMethod · 0.95
setFocusedElementMethod · 0.80
setElementWithFocusMethod · 0.80
getPageMethod · 0.65
getScriptableObjectMethod · 0.65
getActiveElementMethod · 0.45
hasFeatureMethod · 0.45
getChildNodesMethod · 0.45

Tested by

no test coverage detected