@@ -1450,40 +1450,38 @@ private void setHandlerForJavaScript(final String eventName, final Object handle
14501450 }
14511451
14521452 /**
1453- * To be called when the property detection fails in normal scenarios.
1454- *
1455- * @param name the name
1456- * @return the found object, or {@link Scriptable#NOT_FOUND}
1453+ * {@inheritDoc}
14571454 */
1458- public Object getWithFallback (final String name ) {
1459- Object result = NOT_FOUND ;
1460-
1455+ @ Override
1456+ protected Object getWithPreemption (final String name ) {
14611457 final DomNode domNode = getDomNodeOrNull ();
1462- if (domNode != null ) {
1458+ if (domNode == null ) {
1459+ return NOT_FOUND ;
1460+ }
14631461
1464- // May be attempting to retrieve a frame by name.
1465- final HtmlPage page = (HtmlPage ) domNode .getPage ();
1466- result = getFrameWindowByName (page , name );
14671462
1468- if (result == NOT_FOUND ) {
1469- result = getElementsByName (page , name );
1463+ // May be attempting to retrieve a frame by name.
1464+ final HtmlPage page = (HtmlPage ) domNode .getPage ();
1465+ Object result = getFrameWindowByName (page , name );
14701466
1471- if (result == NOT_FOUND ) {
1472- // May be attempting to retrieve element by ID (try map-backed operation again instead of XPath).
1473- try {
1474- final HtmlElement htmlElement = page .getHtmlElementById (name );
1475- result = getScriptableFor (htmlElement );
1476- }
1477- catch (final ElementNotFoundException e ) {
1478- result = NOT_FOUND ;
1479- }
1467+ if (result == NOT_FOUND ) {
1468+ result = getElementsByName (page , name );
1469+
1470+ if (result == NOT_FOUND ) {
1471+ // May be attempting to retrieve element by ID (try map-backed operation again instead of XPath).
1472+ try {
1473+ final HtmlElement htmlElement = page .getHtmlElementById (name );
1474+ result = getScriptableFor (htmlElement );
1475+ }
1476+ catch (final ElementNotFoundException e ) {
1477+ result = NOT_FOUND ;
14801478 }
14811479 }
1480+ }
14821481
1483- if (result instanceof Window ) {
1484- final WebWindow webWindow = ((Window ) result ).getWebWindow ();
1485- result = getProxy (webWindow );
1486- }
1482+ if (result instanceof Window ) {
1483+ final WebWindow webWindow = ((Window ) result ).getWebWindow ();
1484+ result = getProxy (webWindow );
14871485 }
14881486
14891487 return result ;
0 commit comments