
Ask HN: Non-JavaScript DOM Manipulation - api
I&#x27;m researching cross-platform UI and of course Electron and its relatives come up.<p>I don&#x27;t see anything intrinsically wrong with using a web rendering engine as a presentation layer, but I don&#x27;t like the bloat and know that at least some of that bloat comes from the fact that the UI layer is a web app written in JS. I&#x27;m also not a fan of JS.<p>Is there anything out there that allows you to pop open a web rendered window and control the DOM from outside from another language? Seems to me that this would let you do sophisticated HTML5 UIs maybe leveraging things like Bootstrap and Framework7 but without JavaScript and thus without the associated JS VM bloat.<p>If there isn&#x27;t anything like this, someone should make it.
======
lhorie
There's this [https://rustwasm.github.io/wasm-
bindgen/examples/dom.html](https://rustwasm.github.io/wasm-
bindgen/examples/dom.html)

~~~
api
That looks like it runs browser side though. I was thinking of something that
can control the DOM from behind the browser UI window for local UI development
use. Basically just use the web renderer as a renderer in place of e.g. Qt.

~~~
lhorie
Not sure I understand what you want. If you want to use DOM without JS, web
assembly is the only option. If what you want is to call a DOM API without
using a browser, there's jsdom. If you want to drive a browser from outside of
it there's Chrome Debugger Protocol. But ultimately you'll need a browser if
you want to display a UI that is powered by the DOM.

If what you're looking for is a cross-platform API, you could look into React
Native, Flutter or Haxe.

~~~
api
The DOM is just state in the browser. I'm curious about whether there's any
APIs out there to manipulate that state from code outside the browser, e.g.
C/C++ code that is including and instantiating a web control.

It seems like an obvious idea but I have never seen anyone do it.

~~~
lhorie
It sounds like you're looking for something like the Chrome Debugger Protocol.
There are wrappers over it such as Puppeteer that let you spawn a browser
instance and call arbitrary DOM APIs.

~~~
api
I'm thinking of something functionally similar but more efficient and geared
toward UI use.

~~~
lhorie
I'm afraid that doesn't exist, short from forking Chromium.

~~~
api
It should. The web rendering engine is a good way to render but JS adds lots
of bloat.

