Commit 91901d70 authored by Adrian Cochrane's avatar Adrian Cochrane

Describe why implementing flexible targets would be simpler

to implement.
parent 1936c144
# How easy would this be to implement?
The main addition made by this proposal is a append/prepend/replace attributes. And there's a few concerns around this:
## 1. Selecting targets
In order to determine how to render webpages onto their I/O device, browser engines will usually implement (amongst other things) CSS selectors. As long as the selectors in these attributes are resolved upon load, that code can be reused here.
## 2. Inserting responses
All that the selector engine requires from the DOM is it's parent and, less importantly, previous pointers. Because of that it should be trivial to apply any new CSS to any newly-parsed elements, and add the results to the layout tree.
## 3. Replacing elements
There's two two trees elements would need to be removed from here, and I'll need to address them seperately. But in both cases there'd need to be a message notifying the tree to remove the elements.
The layout tree would be trivial to update, because they would need to be doubly-linked in order to apply the layout formulas. Interestingly though frames would need to insert into this tree, but no others.
The document tree meanwhile is more interesting, but it would still need to be updated in case the CSS is updated as well. To handle this you'd need to be able to quickly determine all descendants of a given element. To accomplish this I'd flatten the tree into an array and have each parent count all it's descendants, allowing replacements to be a simple array splice.
Those techniques operating on the document tree would also be useful for making sure CSS adjacency selectors still work.
As such it'd be massively simpler to implement this standard rather than JavaScript and the DOM, whilst still allowing similar interactions.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment