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.
()
| 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} |
nothing calls this directly
no test coverage detected