mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / QuerySelectorAll Method

Selector can be either the CSS3 Selector of the HTML5 Element you wish to manipulate. You cannot use "document" or "window" in this selector.

If you are unfamiliar with CSS3 Selectors have a look in Finding the correct CSS3 Selector article.

In This Topic
    QuerySelectorAll Method
    In This Topic
    Description

    Creates and returns a variant array (VT_ARRAY | VT_DISPATCH) of volatile Just-In-Time (JIT) COM Wrappers / Proxies of HTML5 Element. This feature is designed to allow basic read / write DOM manipulation without resolving to JavaScript execution.

    Syntax
    Visual Basic
    Public Function QuerySelectorAll( _
       ByVal Selector As String _
    ) As Variant
    Parameters
    Selector

    Selector can be either the CSS3 Selector of the HTML5 Element you wish to manipulate. You cannot use "document" or "window" in this selector.

    If you are unfamiliar with CSS3 Selectors have a look in Finding the correct CSS3 Selector article.

    Return Type

    A variant array (VT_ARRAY | VT_DISPATCH) of HTML5Element COM wrappers / proxies that can be used for read/write access to HTML5 DOM.

    Remarks

    HTML5Element COM Class is light-weight wrapper / proxy for HTML5 Elements, Document and Window objects that bridges the gap between COM and Chromium worlds.

    An instance of this COM class holds internally a CSS3-like selector that is used as and when needed for accessing the underlying HTML5 DOM Node of the WebKit Blink Rendering Engine. This COM object is taking advantage of WebKitX IPC mechanism in order to read / write DOM attributes or CSS3 styles synchronously. You may keep a reference to an HTML5Element instance for as long as the WebKitX control and its HTML5 Page are loaded and dispose references when you change page or destroy the control.

    Accessing and Manipulating HTML5 DOM Programmatically with COM Wrappers

    Accessing and Manipulating HTML5 DOM Programmatically with COM Wrappers

    The term "Just-In-Time" means that WebKitX does not keep reference of HTML5Element objects; instances are created and returned to your code as needed. Please note that every time you access a property or method of an HTML5Element instance, WebKitX performs an IPC transaction to the Blink Rendering Engine which resides in out-of-process CEF3 executables. For that reason you are advised to use this feature orthologically and avoid unnecessary interactions as it may slow down rendering performance.

    Example
    Private Sub mnuQuerySelectorAll_Click()
    
        Dim vArray As Variant
        Dim vItem As Variant
        Dim el As HTML5NodeElement
        
        ' Get all elements in a variant array
        vArray = WebKitX1.QuerySelectorAll("div")
        
        ' Loop using variants
        For Each vItem In vArray
            
            ' QueryInterface the IDispatch to HTML5NodeElement (or any suitable)
            Set el = vItem
            
            ' Access HTML5 Element
            Debug.Print el.[_selector]
            
        Next
            
    End Sub
    See Also