[Vorlon.js] Focus on DOM Explorer

This article is the first of a new series of articles about Vorlon.js. The goal is to do a focus on a specific feature each time.

Today I would like to start with one of the biggest: the DOM Explorer:

Installing Vorlon.js

Just as a reminder, here is what you have to do to use Vorlon.js:

  • Install and run the Vorlon.JS server from npm:

    $ npm i -g vorlon
    $ vorlon

  • Once Vorlon.js is done installing, you can now run the server:

    $ vorlon
    The Vorlon server is running

  • With the server is running, open https://localhost:1337 in your browser to see the Vorlon.js dashboard.

  • The last step is to enable Vorlon.js by adding this script tag to your app:

Now when you open your app you should see your client appear on the dashboard.

Using the DOM Explorer

By default, the DOM explorer is on but if you need to enable it, you have to go to [Vorlon folder]Serverconfig.json and enable the plugin:

{
    "useSSL": false,
    "includeSocketIO": true,
    "activateAuth": false,
    "username": "",
    "password": "",
    "plugins": [
        { "id": "DOM", "name": "Dom Explorer", "panel": "top", "foldername": "domExplorer", "enabled": true }
    ]
}

Once enabled you will be able to control almost everything related to the DOM through plugin’s main window.

And here is what you’ll be able to do:

Selection overlay

By moving your mouse over any node, you will be able to see where this node belongs on the client side:

Live text editing

By double-clicking on any text inside the DOM explorer window, you have the ability to live edit it:

But you can also use the HTML section on the right pane to edit HTML text content:

This feature can also be reached by right-clicking on the node itself

Attributes edition

Nodes’ attributes are also editable by just clicking on them:

But you can also right click on the node name itself to add a new attribute:

By right-clicking on existing attribute, you will get even more options like updating value or name or deleting the attribute:

Search using CSS selector

When dealing with big HTML pages you may want to search a specific node. This is why we introduced the “search node by css selector” feature.

Just enter your selector in the search box and you’re done!

Dynamic refresh

The DOM Explorer window can either be automatically refreshed when client DOM changes (beware as this could consume a lot of CPU power and network bandwidth even if we use delta updates) or can be refreshed on demand.

Auto refresh in controlled on the settings pane:

When auto refresh is off, the Refresh button can tell you if there are available updates on the client side (The little dot on the button will turn red):

In this case, just clicking on the button will launch a complete refresh of the page

Styles editor

When you click on a node, the Styles pane will present you all the styles explicitly defined for this node:

You can then use the “+” button to add new style or click on existing ones to change their value:

To see ALL styles applied to a node (including implicit ones), you just have to use the Computed Styles pane:

Layout

Like browsers’ F12 tools, the Layout pane is here to help you understand the layout of every node that you select:

Finally, last one thing that you can find useful: When a node has an ID, you can click on the little button on the right of the node to have it linked directly in the interactive console where you will be able to execute the code you want with it:

Going further

That’s a lot of feature for a single plugin. I hope it will help you debug and fix your remote sites or web apps!

If you are interested by going further with Vorlon.js, you may find these articles interesting:

We are also looking for more contributors to help us creating the most useful tool possible. So if you are interested in contributing, please visit our gihub repository: https://github.com/MicrosoftDX/Vorlonjs