In my past job, we rewrote our spreadsheet rendering to use canvas and gained massively in simplicity and maintainability. And there was no obfuscation angle to it - we even shipped source maps! Handling accessibility and text input was hard (we ended up adopting a hybrid-DOM model where some things like input fields were still native ones, or shadowed by native ones), and even then it was still easier than dealing with browser rendering.
This is simply a reasonable way to work around the DOM being trash. The way to fix this trend would be to reimagine the presentation layer of the browser as something other than a stack of hacks over hypertext, but so far nobody seems to have a good solution.
About a decade ago I had the start of a Eureka moment on how to do this (back then — https://medium.com/space-net/spacenet-51aca95d49a2, nowadays https://treenotation.org/). It seems to me we've missed a sort of fundamental universal notation of the universe, which you can think of as "two-dimensional binary". I predict we will soon see a Cambrian Explosion of new formats and languages that are simpler and more interoperable with each other, and some will have the opportunity to build new great languages for rendering stacks.
I like what you've done with it, I'll need to take a closer look.
While I was thinking about it, I also decided to take a look into prior art, which took me all the way back to Landin's "The Next 700 Programming Languages" from 1966 which introduced the hypothetical language ISWIM, which was the first to introduce indentation based syntax and inspired the ML and Haskell family of languages (https://www.cs.cmu.edu/~crary/819-f09/Landin66.pdf)
It wasn't exactly what I was looking for, but it's fascinating to see how long we've been thinking about these kinds of issues.
Some more interesting read's in this space:
2003 - Egil Möller's I-expressions - https://srfi.schemers.org/srfi-49/srfi-49.html
1984 - Alan Kay's 3-D spreadsheet - http://worrydream.com/refs/Kay%20-%20Computer%20Software%20-...
1972 - Mark Wells' A Review of Two-Dimensional Programming Languages - http://sci-hub.cc/10.1145/942576.807009
Here's what I have in my notes buffer; I hadn't gotten much further than this.
Ssn: /([0-9]{9})|([0-9]{3})-([0-9]{2})-([0-9]{4})/\1\2\3/
People: Table
first: String
last: String
dob: Date
ssn: SSN
Csv
headings: True
load people.csv
as: People
select first last dob
filter dob.age > 21
Well, I had some discussion, alternate forms of the syntax, links to prior art, etc, but not much else worth sharing.Will have to add your TreeNotation and Ohayo to that list, as well as these other links you've shared.
When you two-dimensionalize S-Expressions and remove the parens, you get Tree Notation.
Bookmarked for a later in-depth read but my interest is piqued!
An updated spec: https://faq.treenotation.org/spec/
For what it’s worth, I have been interested in the concept of 2d languages for quite some time, and I’m not sure what your definition is.
To me this seems to have a 1d topology - I.e. it’s still left to right top to bottom, and there are no loops or semantics that require reading in other directions.
I contrast this with something like a circuit diagram or labview program.
I may be missing something though.
What would a good API look like, I wonder?
The response is to write an opaque, vendor-specific "DOM". Which is the complete opposite of what HTML was supposed to be. But the browser is now a platform and not a browser, so the metaphors are horribly mixed to the point where I'm not even sure what a DOM is supposed to be anymore.
I wish the web had evolved in a more documenty way.
What you expected to see isn't alwasy what you got.
WYETSIAWYG
Rendering across browsers and operating systems was a trainwreck until maybe 5 years ago (over a decade of polyfill is finally gone). And even with an ecosystem like ElectronJS + Bootstrap, Win10 MacOS and Linux all look slightly different.
So yes and no to "DOM was always...", but more "No."
This is a thread about Google Docs. Your suggestion to the Docs team is to ... stop? Just shut down their product?
/s
[0] https://www.libreoffice.org/download/libreoffice-online/
But the rest of us plebs...
Alternatively: return to monke.
I spent many years working on that sort of thing, a decade ago.
For these things, using the DOM is painful. When the pain becomes great enough, the biggest available escape hatch is pure native 2D rendering (canvas), which is a nightmare for accessibility and affordance to end-users. It would be awesome to have something else to escape to.
Source: I am a Ruffle developer and have had to do exactly this to support text input in old Flash games.
Expect an AI-based OCR browser extension to copy text to the system clipboard. Possibly by sending screenshots to some centralized service ;-)
Xforms 2.0, and other opportunities to have rich text in browser not suck were there for the browser maker to take in the last 15 years.
Instead they tried almost everything instead of choosing the most obvious solution, and fixing it.
I develop an NLP labelling interface (which is similarly document-focused) in JS all day and can attest to this.
Here's some specific examples:
- To work out where some text is being being laid out, eg to display some UI around it, the Selection/Range/Rect APIs will help but Rects are always viewport-relative, so you'll need to convert them to element-relative to position your UI, which sucks.
- Firefox supports multiple DOM Ranges per Selection (ie allows non continguous text selection), but nearly all other browsers support a single range.
- You can't truncate text across multiple lines (the CSS line clamp spec is an experimental fix)
- If you want to pop up an interface while some text is selected, you'll need to capture and reimplement selection because as soon as another item is focused the selection will no longer display.
If you're into JS and building anything document related, I've written a bunch about the some of the issues at https://humanloop.com/blog/how-to-build-an-ml-labelling-inte...
This comes across as a ‘you’re holding it wrong’ type argument.
If that's the case, it probably would have been better to standardize some better APIs.
Thus I wouldn’t necessarily interpret Google Docs making this move as the start of an inescapable trend. It may be, or it may just be that certain kinds of applications (like Docs and Games) can work a lot better by providing their own rendering engine.