Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Rebol's runtime abstraction of block! is not adequate for getting coverage of the DOM. One technical barrier is that you can't get the single unique "parent" of a block, as it may be aliased at several locations. So for instance:</p> <pre> >> foo: [div id: "foo"] == [div id: "foo"] >> bar: [div id: "bar"] == [div id: "bar"] >> paragraph: [p ["Hello"]] == [p ["Hello"]] >> append foo append/only [contents:] paragraph == [div id: "foo" contents: [p ["Hello"]]] >> append bar append/only [contents:] paragraph == [div id: "bar" contents: [p ["Hello"]]] >> append second paragraph "World" == ["Hello" "World"] >> foo/contents == [p ["Hello" "World"]] >> bar/contents == [p ["Hello" "World"]] </pre> <p>There's no way to write a function that can meaningfully answer questions like "get-parent bar/contents". Although you've got something which has been parsed and brought into a structure you can manipulate, it isn't a structure with particular designs matching the DOM.</p> <p>To climb around it freely as a tree you'd have to build a bunch of objects connected with references. That's pretty much what every other language does, so no free lunch to be had here. On the plus side, part of the parsing is taken care of for you and there's quite a bit of manipulation you can do without a DOM library. It's a way better place to start than text!</p> <p>On the downside, it can seem so freeform that you wonder what use cases it was optimized for. The answer is that it specifically <i>wasn't</i> optimized for anything, other than dialecting Rebol. :) Circular reasoning, but it has given rise to the properties that make the language interesting to study and which makes it sort of "timeless".</p> <p>You might find aspects of the <a href="http://rebol.net/wiki/Extended_tag_proposal" rel="nofollow noreferrer">extended tag proposal</a> and the discussion it provoked to be illuminating.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload