Method XbpHTMLViewer2():queryByTag() Foundation

Gets the HTML element with a certain tag name.

Syntax
:queryByTag( <cTag> ) --> oAsyncResult
Parameters
<cTag>
The tag name of the HTML element.
Return

A AsyncResult() object which can be used to wait for the query operation to complete, and for retrieving the operation result. The operation result either is a representation of a HTML element matched in the query or the value NIL. If the method fails, the returned AsyncResult object will be in error state. Use :error() to determine more information about the error.

The returned data objects at least have the members :nodeName, :nodeValue, :attributes, :childNodeCount and :children. Attributes are returned as members of a data object in :attributes, with the attribute values stored in a member with the same name as the attribute.

Description

The method :queryByTag() returns information about the HTML element that has the specified tag name.

If a matching HTML element is found, :queryByTag() returns a read-only representation of the HTML element as the operation result. If more than one element matches the criteria, only a representation of the first element is returned. This can be used to check for the existence of certain HTML elements as well as for examining attribute values. Changing page elements via the operation result is not possible. Use :executeScript() or some other means to achieve this.

:queryByTag() executes asynchronously in the context of the current page. The page must be fully loaded and the DOM (document object model) tree must be stable for the method to function properly. If the HTML viewer is currently in the process of navigating to another page, for example, querying the DOM tree may fail or produce unexpected results. In this case, use the result object returned by :navigate() or the :navigateComplete() event to wait for navigation to complete before performing the query. To immediately retrieve the operation result, use the :get() method of the AsyncResult() object returned by :queryByTag().

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.