0.0.59 • Published 2 months ago

be-based v0.0.59

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

be-based WIP

TODO Using MountObserver

be-based is a package that allows a DOM document fragment filled with relative URL paths, to be adjusted based on a base URL. This is quite critical when streaming HTML from a third-party element to a DOM node contained within the Live DOM tree. be-based plays a critical role in combination with be-written.

NPM version How big is this package in your project? Playwright Tests

The syntax:

<div be-based="https://www.supremecourt.gov/about/">
    <a href="biographies.aspx#SOConnor">O'Connor, Sandra Day</a>
<div>

is shorthand for:

<div be-based='{
    "base": "https://www.supremecourt.gov/about/",
    "forAll": ["href", "src", "xlink:href"]
}'>
    <a href="biographies.aspx#SOConnor">O'Connor, Sandra Day</a>
</div>

be-based rewrites the attribute within:

<div is-based="https://www.supremecourt.gov/about/">
    <a href="https://www.supremecourt.gov/about/biographies.aspx#SOConnor">O'Connor, Sandra Day</a>
</div>

Side service -- Declarative Shadow DOM

be-based also takes it upon itself, in the absence of any apparent alternatives, to make the same Declarative Shadow DOM syntax that works when streaming HTML to the browser, to also work while streaming a separate HTML fetch request to a DOM element.

Side service -- Element Matching

Another service be-based provides is it can be subscribed to for any CSS matches it encounters. This feature is used by be-rewritten.

As a custom attribute / decorator / behavior

be-based is one of a growing family of be-decorated web component based custom attributes / behaviors / decorators / directives.

By referencing be-based.js, elements with attribute be-based will be discovered and transformed.

Or we can reference index.js, which loads both trPlugin.js (template instantiation plug-in) and be-based.js in parallel.

The element be-based can decorate is not limited to template elements. It can be applied to any DOM element.

If using stream-orator to stream HTML to a target element, be-based can be used to watch all new elements, and apply all the rules as they are discovered.

This seems to work quite well with Chromium based browsers running on windows (rewriting image url's before the browser tries the original, invalid url), but isn't so effective with Firefox.

Update: Well, on Chromium based browsers, it doesn't seem so reliable either, at least depending on when I try.

As a cloudflare HTMLRewriter Class TODO

As a service worker helper TODO

W3C willing.

0.0.59

2 months ago

0.0.57

2 months ago

0.0.58

2 months ago

0.0.55

3 months ago

0.0.56

3 months ago

0.0.53

4 months ago

0.0.54

4 months ago

0.0.52

4 months ago

0.0.51

4 months ago

0.0.50

8 months ago

0.0.49

10 months ago

0.0.47

11 months ago

0.0.48

11 months ago

0.0.43

11 months ago

0.0.44

11 months ago

0.0.45

11 months ago

0.0.46

11 months ago

0.0.42

12 months ago

0.0.41

1 year ago

0.0.40

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.37

1 year ago

0.0.38

1 year ago

0.0.39

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.34

1 year ago

0.0.35

1 year ago

0.0.36

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago