documentation
connecting bitty
data-connect
- Each
<bitty-8>requires adata-connectattribute. - The attribute defines the path to the JavaScript module to load.
- Modules must contain an
export const b = {}in order to work with bitty. - Multiple
<bitty-8>tags can be placed on a single page. - Multiple modules can contain functions with the same name. Each will respond to incoming signals regardless of their source.
-
Make a connection to a module.
HTMLwaiting Send B1D0F_v1JavaScript;Resultwaitingview test harness
bitty tag for the example<!-- the bitty tag for this example is embedded directly in the example HTML -->bitty tag for the test verificationVerification JavaScript; -
Load multiple bitty modules on the same page.
HTMLwaiting Send A2EB2_v1 waiting Send A2EB2_v2JavaScript;;Resultwaitingwaitingview test harness
bitty tag for the example<!-- the bitty tags for this example is embedded directly in the example HTML -->bitty tag for the test verificationVerification JavaScript; -
All modules with a signal function name respond to it.
HTMLwaiting waiting Send 9E5B8_v1JavaScript;;ResultwaitingwaitingNotes- [x] Each of these modules contains the same function named
signal_9E5B8_v1. - [x] When that signal is received, each one triggers another signal to an independent function
(
signal_9E5B8_v2in the first module andsignal_9E5B8_v3in the second).
view test harness
bitty tag for the example<!-- the bitty tags for this example is embedded directly in the example HTML -->bitty tag for the test verificationVerification JavaScript; - [x] Each of these modules contains the same function named
initialization functions
- [x] An
initkey can be passed in theexport const b = {}to run initialization functions. - [x] The value can one or more functions to call.
- [x] Functions can be async but are not awaited (i.e. if you need for things to happen only after the initialization process you can use
b.trigger()at the end to first the other functions).
-
Run an initialize function.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Run multiple initialization functions.
HTMLwaiting waitingJavaScript;Resultwaitingwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
await async init functions.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
html attributes
data-listen
- bitty listens for
clickandinputevents ondata-selements by default. - The
data-listenattribute can be used to change the events that an element listens for. - If a
data-listenattribute is used the element stops listening for the defaultclickandinputevents. - The default
clickandinputevents can be added back in as part of thedata-listento continue listening for them.
-
Listen for a different type of event.
HTMLwaitingJavaScript;ResultwaitingNotes- This example uses a
keydownlistener to allow automated testing (e.g. compared to a mouseover which is harder to automate) - bitty provides a
mapKey()function that's likely to be of more use if you need to monitor key presses. Details on it are below.
view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; - This example uses a
-
The default event types (i.e. `click` and `input`) don't trigger if there's a `data-listeners` attribute exists on a `data-s` element and the value does not contain the default event types.
HTMLwon't change on click Click does nothing for 66EA5_v1JavaScript;Resultwon't change on clickview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
The default `click` and `input` event types can be added back into `data-listeners` to continue listening for them.
HTMLwaiting Send 70830_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
data-r
-
Receive a single signal.
HTMLwaiting Send E9FCA_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
data-s
- The
data-sattribute defines what signals an element sends when an event it's associated with fires. - Multiple signals can be sent at the same time.
- Signals sent that have no corresponding receivers trigger their related function once with a null value for the third/element argument.
-
Send one signal to a single receiver.
HTMLwaiting Send B28CE_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Send one signal to multiple receivers.
HTMLwaiting waiting Send 294BF_v1JavaScript;Resultwaitingwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Send multiple signals to multiple receivers.
HTMLwaiting waiting Send 91921_v1JavaScript;Resultwaitingwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
bitty functions
b.addListener(event, signals)
- [x] Adds an event listener for a given event and sets it up to send the corresponding signals when it occurs.
- [x] Can be used to fire signals for events that aren't associated with an element.
- [x] Can be used to fire signals that could be associated with an element (e.g. you can add a
clicklistener that listens for any click on the page) - [x] Signal functions are called with the three arguments. If there's no receiver, it's
signalName(event, null, element). If there's a receiver, it'ssignalName(event, null, element)
-
Connect events to signals.
HTMLwaitingJavaScript;ResultwaitingNotes- This test uses a custom event to automate the demo.
- The featured uses
addEventListener()and can use any event that works with the method (e.g.resizeevents on the window).
view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.addStyles(css)
-
Add a set of styles
HTMLwaiting Send E3859_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.ce(tag, options)
- An alias for
document.createElement(tag, options)
-
create an element
HTMLwaiting Send FDC74_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
config
- [x] Configuration values.
- [x] Defaults for
b.getState()are set and can be overridden here.
-
Check the default config.
HTMLwaiting Send 3FE8F_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.copy(selector)
- [x] Copies the text from the given selector via
document.querySelector(). - [x] The copied text comes from a
.valueif the element has one. - [x] Otherwise, the text copied text comes from
.innerHTML. - [x] Returns true if the copy succeeded.
- [x] Returns false if the copy failed.
-
Copy text from a `.value`
HTMLThis example uses the OS copy/paste board. It can't be properly tested from inside the browser. Use this button to copy the text from above and paste it into another location to watch it in action. Copy Text D0CD6_v1JavaScript;ResultThis example uses the OS copy/paste board. It can't be properly tested from inside the browser. Use this button to copy the text from above and paste it into another location to watch it in action.
view test harness
bitty tag for the examplebitty tag for the test verification<!-- Testing this example is done manually -->Verification JavaScript// There is no test script for this example. // Testing is performed manually. -
Copy text from `.innerHTML` if no `.value` is available.
HTMLTest .innerHTML content for signal_85F23_v1 This example uses the OS copy/paste board. It can't be properly tested from inside the browser. Use this button to copy the text from above and paste it into another location to watch it in action. Copy Text 85F23_v1JavaScript;ResultTest .innerHTML content for signal_85F23_v1This example uses the OS copy/paste board. It can't be properly tested from inside the browser. Use this button to copy the text from above and paste it into another location to watch it in action.
view test harness
bitty tag for the examplebitty tag for the test verification<!-- Testing this example is done manually -->Verification JavaScript// There is no test script for this example. // Testing is performed manually.
b.data
- [x] The storage location for data that's pulled in from
<script type="application/json" id="ID">tags on the page and data retreived viab.getData(url)
-
Access stored data.
HTMLwaiting Send 3A374_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.debounce(key, signals, ms, payload = {})
- Provides debouncing for triggering signals.
- Signals are triggered via
b.send(payload, signals)when the debounce resolves. - The payload is optional. If one isn't defined when calling the function an empty object is sent automatically.
-
Debounce triggering a second signal.
HTMLwaiting to start debounce Start debounce AF23A_v1JavaScript;Resultwaiting to start debounceview test harness
bitty tag for the examplebitty tag for the test verification<!-- debounce is tested manually -->Verification JavaScript;
b.dedupe(array)
- [x] Takes an array of strings and returns a new array with duplicates removed.
- [x] The values are de-duplicated by adding them to a Set then turning the set back into an array.
- [x] The insertion order of items is maintained with the first instance of a duplicate value determining
-
Dedup an array
HTMLwaiting Send 12A9F_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.deletePageData(key)
[x] Delete the data and associated key from the page specific storage.
-
Delete data from the page specific storage.
HTMLwaiting Send C1884_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.deleteSiteData(key)
[] Deletes the data for the given key from the site wide storage.
-
TKTKTK: Test name
HTMLwaiting Send 203EF_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.forwardSender(el)
- [x] Triggers a new function with the
elpassed in thesenderposition (i.e. the second argument). - [x] Implement to provide a native way to initialize content that requires one element to send to another that would otherwise require a click or some other interaction.
- [x]
undefinedis passed for theevposition (i.e. the first argument).
-
Forward an element to another function in the `sender` location (i.e. the second argument)
HTMLwaiting 0F980_v1 in run automaticallyJavaScript;Resultwaiting0F980_v1 in run automaticallyview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.getData(url, options = {});
- [x] Fetches a JSON from a URL.
- [x] Returns the JSON object if the fetch succeeds and the response parses as JSON.
- [x] Returns undefined if either the fetch fails or the JSON fails to parse.
- [x] Accepts and optional options object which is passed to the fetch call (e.g. for headers).
- [x] Logs any errors to the console.
-
Fetch and return a JSON object.
HTMLwaiting Send AD8E1_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return `undefined` if the fetch fails.
HTMLwaiting Send F791C_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return `undefined` if JSON fails to parse.
HTMLwaiting Send E732B_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Pass options to the fetch call.
HTMLwaiting Send 05109_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.getMarks(key)
- [] Returns an array of the
performance.now()marks for the given key.
-
Get the array of marks for a given key.
HTMLwaiting Send F7BED_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.getState()
- [x] Produces an object with the state of input values and specific attributes on elements.
- [x] Elements with both an
idand adata-save="true"attribute are included. - [x] The object can be used with
b.setState()to reset the state of a page when it's reloaded. - [x] The specific attributes that are captured are available in
b.config.getState. - [x] The
b.config.getStateobject contains two categories:b.config.getState.attributesandb.config.getState.keysthat hold their corresponding keys. - [x]
ariaattributes are stored inb.config.getState.attributeswith the full JavaScript version of their name (e.g.aria-hidden). - [x] Items that aren't set with
el.setAttribute()are defined inb.config.getState.keys(e.g.value,checked).
-
Store an input value.
HTMLwaiting Send 4ED33_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.getTemplates(url, options = {})
- [x] Fetches a URL to get templates from.
- [x] Each
<script>tag on the page is processed to determeine if it's a template. - [x] Any
<script>tags with a type oftetx/htmland anidattribute is used for an HTML template. - [x] Any
<script>tags with a type ofimage/svgand anidattribute is used for an SVG template. - [x] Any
<script>tags with a type ofapplication/jsonand anidis stored as data. - [x] HTML templates are stored as strings inside the
b.templatesobject with theidacting as the key in the object. - [x] SVG templates are stored as strings inside the
b.svgsobject with theidacting as the key in the object. - [x] The
application/jsonstrings are run throughJSON.parse()and stored insideb.dataif the string parses successfully. - [x] Options can be passed to the fetch call with the optional section argument.
- [x] The source file that's being fetched shouldn't be a full HTML file. It should only contain one or more script tags that are all siblings of each other.
-
getTemplates(url, options)
HTMLwaiting Send D33B5_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;Notes- The source template file used is /versions/8/0/0/documentation/samples/templates/
- You'll have to view source on the page to see anything since the script tags don't render anything to the page.
b.loadPageData(key, fallback = undefined);
- [x] Returns an object from the page specific IndexedDB object store with the given key.
- [x] Returns a string from the page specific IndexedDB object store with the given key.
- [x] Provides for an optional object fallback to use if there's nothing in storage with the given key.
- [x] If the fallback is used, it gets saved automatically.
- [x] Returns
undefinedif there's no value for the key and there's no fallback.
-
Restore page data.
HTMLwaiting Send BB235_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Load a string from the page storage.
HTMLwaiting Send 80ADA_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return a fallback if the given key isn't in the page's storage.
HTMLwaiting Send 72ACD_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Fallback is saved automatically if it's used.
HTMLwaiting Send 23ABD_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return `undefined` if there's no key and no fallback.
HTMLwaiting Send 33173_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.loadSiteData(key, fallback = undefined)
- [x] Returns an object from the site wide IndexedDB object store with the given key.
- [x] Returns a string from the site wide IndexedDB object store with the given key.
- [x] Provides for an optional object fallback to use if there's nothing in storage with the given key.
- [x] If the fallback is used, it gets saved automatically.
- [x] Returns
undefinedif there's no value for the key and there's no fallback.
-
Load existing JSON
HTMLwaiting Send B31DA_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Load a string from the site storage.
HTMLwaiting Send B85B7_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Use an optional object fallback if there is nothing in storage for the given key.
HTMLwaiting Send 6E439_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Fallback is automatically saved into storage if it's used.
HTMLwaiting Send 284A3_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return `undefined` if there's not a value in storage for the key and there's no fallback.
HTMLwaiting Send E4425_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.mapKey(key, signals, modKeys = [], options = {})
- [x] Maps a key event to a signal signal.
- [x] Maps a key event to multiple signals.
- [x] Uses keydown by default.
- [x] Listener can be set to
keyup. - [x] Modifier keys can be defined (see
modKeyAliases()for the list of keys). - [x] The event won't trigger if unknown modifier keys are specified.
- [x] Prevents the browser from responding to the key press via preventDefault.
- [x] preventDefault can be turned off.
- [x] Key Codes can be used instead of strings by using a number instead of the character.
-
Map a single key to a single signal
HTMLwaiting Press `q`JavaScript;ResultwaitingPress `q`view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Map a single key to multiple signals.
HTMLwaiting waiting Press `w`JavaScript;ResultwaitingwaitingPress `w`view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Map a key with modifier keys (e.g. "shift", "alt", etc...)
HTMLwaiting Press `ctrl + e`JavaScript;ResultwaitingPress `ctrl + e`view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Aliases (e.g. `ALT`) can be used in place of the explicit JavaScript event names (e.g. `altKey`). The full list of options is available in `modKeyAliases()`.
HTMLwaiting Press `ctrl + r`JavaScript;ResultwaitingPress `ctrl + r`view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Unknown modifier keys are not allowed.
HTMLthere's no output from this example.JavaScript;Resultthere's no output from this example.view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Allow default action to occur (i.e. don't apply `preventDefault()` to the event).
HTMLwaiting Press `/`JavaScript;ResultwaitingPress `/`view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Use `keyup` instead of `keydown`
HTMLwaiting Press `b`JavaScript;ResultwaitingPress `b`view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Use a key code instead number of a character string.
HTMLwaiting Press `y`JavaScript;ResultwaitingPress `y`view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;NotespreventDefault()is applied unless otherwise specified.- If
preventDefault()occurs for any key viamapKey()it affects all the other uses of that key (i.e. trying to usepreventDefault()for a key in one place and not in another causes a race condition with undefined behaviour).
b.mark(key, note = null)
- [x] Used for basic performance measuring.
- [x] Marks are created with a key.
- [x] The array for a given mark can be retrieved with
b.getMarks(key)
-
Create a mark for a key without a note.
HTMLwaiting Send D2586_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.modKeyAlises()
- [x] Returns the object that holds the available aliases for modifier keys used with
mapKey() - [x] The values sent to
mapKey()are case insensitive (they always transformed to lowercase when doing the mapping).
-
Get the aliases
HTMLwaiting Send 13C5D_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.qs(selector, el = null)
- [x] Alias for
document.querySelector(selector)if no second argument is passed. - [x] Alias for
el.querySelector(selector)if an element is passed as the second argument.
-
Get an element from the document.
HTMLwaiting Send B7BA2_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Get an element from another element.
HTMLwaiting Send A9BED_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.qsa(selector, el = null)
- [] Alias for
document.querySelectorAll(selector)
-
Get a group of elements from the document.
HTMLalfa signal_00C0F_v1 bravo signal_00C0F_v1 charlie signal_00C0F_v1 waiting Send 00C0F_v1JavaScript;Resultalfa signal_00C0F_v1bravo signal_00C0F_v1charlie signal_00C0F_v1waitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Get a group of elements from another element.
HTMLalfa signal_C0EE2_v1 bravo signal_C0EE2_v1 charlie signal_C0EE2_v1 waiting Send C0EE2_v1JavaScript;Resultalfa signal_C0EE2_v1bravo signal_C0EE2_v1charlie signal_C0EE2_v1waitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.quickCopy(el, sender, options = {})
- [x] Copies the contents of
el. - [x] Captures the
innerHTMLof sender and replaces it withCopiedif successful - [x] Replaces it with
Could not copyif it failed. - [x] Debounces and then restores the innerHTML when the debounce resolves.
-
Do a quick copy
HTMLthis is content on 49568_v1 for quickCopy Send 49568_v1JavaScript;Resultthis is content on 49568_v1 for quickCopyview test harness
bitty tag for the examplebitty tag for the test verification<!-- Testing this example is done manually -->Verification JavaScript// There is no test script for this example. // Testing is performed manually.
b.randomFloat(min, max)
-
Get a random float.
HTMLwaiting Send D3AE7_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.randomInt(min, max)
-
Get a random int.
HTMLwaiting Send D1016_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.render(source, substitutions = {})
- [x] Input can be the key for a template in
b.templatesin which case that template gets used. - [x] Input can be the key for a template in
b.svgsin which case an SVG is generated. - [x] Input can be a HTML string.
- [x] Input can be an array of HTML strings which get joined via
.join(""). - [x] Input can be an HTML element.
- [x] Input can be an array of HTML element.
- [x] Input can be a document fragment.
- [x] Input can be an array of document fragments.
- [x] Input can be an array of different types (i.e. strings, elements, and document fragments).
- [x] If the input is a string, it's first checked to see if it matches a key in
b.templates. If not, bitty looks for a key inb.svgs. If one isn't found there either then the string is processed as a raw input string. (Inputs processed as strings are always treated as HTML. SVGs can only be rendered by including them inb.svgswhich can be loaded viascript type="image/svg"tags on the page, fromb.getTemplates(), or by adding one tob.svgsby hand.) - [x] An object with find/replace values can be sent as an optional section argument.
- [x] The keys in the object are the values to find.
- [x] The values in the object are what replaces the found keys.
- [x] The find/replace is done by converting the input into a string if it's not already then using
.replaceAll(). - [x] Replacement values can be a string.
- [x] Replacement values can can be an array of strings which get joined via
.join(""). - [x] Replacement values can be an HTML Element.
- [x] Replacement values can be an array of HTML Elements.
- [x] Replacement values can be a Document Fragment.
- [x] Replacement values can be an array of Document Fragments.
- [x] Replacement values can be an array of different types (i.e. strings, elements, and document fragments).
- [x] Elements and document fragments are turned into strings for find/replace (i.e. if you hold them in a variable and update the variable the replaced values does not change.)
- [x] The output is a document fragment if the input is an HTML template, strings, html elements, or document fragments.
- [x] The output is an SVG element if the input is an template from
b.svgs.
-
From a template in `b.templates`
HTML266A8_v1 waiting Send 266A8_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
From a string.
HTMLwaiting Send 87F58_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
From an array of strings.
HTMLwaiting Send EDB2D_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
From an element.
HTMLwaiting Send 46394_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
From an array of elements.
HTMLwaiting Send 8F598_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
From a document fragment.
HTMLwaiting Send 07A1D_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
From an array of document fragments.
HTMLwaiting Send 7F9A6_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
From an array of mixed types.
HTMLwaiting Send 8CA16_v1JavaScript; const input = ; input. = "8CA16_v1"; const child2 = document.; child2. = "8CA16_v1"; input.;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Replace with string.
HTMLwaiting Send A40A5_v1JavaScript; const input = "<div>NEEDLE</div>";Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Replace with an array of strings.
HTMLwaiting Send 8E653_v1JavaScript; const input = "<div>NEEDLE</div>";Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Replace with an element.
HTMLwaiting Send E7902_v1JavaScript; const input = document.; const newEl = document.; newEl. = "TARGET_signal_E7902_v1"; input.; const subEl = document.; subEl. = "UPDATED_signal_E7902_v1"; const subs = ;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Replace with an array of elements.
HTMLwaiting Send 91C63_v1JavaScript; const input = document.; const newEl = document.; newEl. = "TARGET_signal_91C63_v1"; input.; const subEl1 = document.; subEl1. = "UPDATED"; const subEl2 = document.; subEl2. = "signal_91C63_v1"; const subs = ;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Replace with a document fragment.
HTMLwaiting Send AC976_v1JavaScript; const input = document.; const newEl = document.; newEl. = "TARGET_signal_AC976_v1"; input.; const subFragment = document.; subFragment. = "<div>UPDATED_signal_AC976_v1</div>"; const subs = ;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Replace with an array of document fragments.
HTMLwaiting Send 76437_v1JavaScript; const input = document.; const newEl = document.; newEl. = "TARGET_signal_76437_v1"; input.; const subFragment1 = document.; subFragment1. = "<div>UPDATED</div>"; const subFragment2 = document.; subFragment2. = "<div>signal_76437_v1</div>"; const subs = ;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Replace with an array of mixed types.
HTMLwaiting Send 68377_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Render an SVG.
HTMLwaiting Send 58881_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Boolean values sent in replacements turn into strings.
HTMLwaiting Send A9D87_v1 __BOOLEAN__JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Numbers used as replacement values are converted to strings.
HTMLwaiting Send 58E28_v1 __FLOAT__JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
null is converted to a string when it's used as a replacement value.
HTMLwaiting Send 9F4E9_v1 __NULL__JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.savePageData(data, key)
- [x] Saves a string to a page specific IndexedDB object store with the given key.
- [x] Saves an object to a page specific IndexedDB object store with the given key.
- [x] Returns the value of the
resultfrom the IndexedDBput(which is the key if the insert succeeded. TBD on what is returned if there's an error).
-
Save page data.
HTMLwaiting Send 09889_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Save a string to the site wide storage.
HTMLwaiting Send 054ED_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.saveSiteData(data, key)
- [x] Saves a string to a site wide IndexedDB object store with the given key.
- [x] Saves an object to a site wide IndexedDB object store with the given key.
- [x] Returns the value of the
resultfrom the IndexedDBput(which is the key if the insert succeeded. TBD on what is returned if there's an error).
-
saveJSON(key, data)
HTMLwaiting Send C087F_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
TKTKTK: Test name
HTMLwaiting Send 38755_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.send(payload, signal)
- [x] Sends a payload to a single from inside another function.
- [x] One more signals can be sent at the same time.
- [x] Signals are sent as events that travel up the DOM. They can be received and run by any bitty related function in any order (i.e. the signals might execute in an order different to the initial list).
- [x] The first argument passed to a signal function is the payload from the
.send(payload, signals)call. - [x] The second argument is always
undefined. - [x] If there are receiving elements, then the function is called once for each with the element passed in for the third argument.
- [x] If there are no receiving elements, then the function is called one time with a
undefinedvalue for the third argument. - [x] Payloads can be strings, arrays, or objects.
-
Used `.send()` to pass a payload to a signal function.
HTMLwaiting Send 8919E_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Send a string as the payload
HTMLwaiting Send 52B45_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Send the same payload to multiple signals.
HTMLwaiting waiting Send A8E3D_v1JavaScript;Resultwaitingwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
The second argument passed to a signal function from `.send()` is always `null`.
HTMLwaiting Send 88408_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
If there are no receiving elements that correspond to a `.send()` call the function is passed a `null` for the third argument and fires exactly one time.
HTMLwaiting Send 03E2A_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.setCSS(key, value)
- Sets a custom CSS property variable to the given value.
-
Set a custom CSS property variable.
HTMLwaiting Send 7D5A1_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.setState(payload)
- [x] Takes an object and updates the attributes of elements captured in it by
id. - [x] The
b.getState()method produces the object. - [x] The object consists of an array of objects containing values for
keys (e.g.
value,checked) and attributes (e.g.data-key,aria-hidden). There are no function in the object (i.e. it can be produced outside ofb.getState()).
-
Update elements via `g.setState(payload)`
HTMLwaiting Send 95950_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Update keys (e.g. `value`, `checked`, etc... See `b.config.getState.keys` for the full list which can also be updated as needed)>
HTMLwaiting Send 37935_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.shuffle
- [x] Shuffles an array by modifying it to reorder the items.
-
Shuffle an array.
HTMLwaiting Send 622FB_v1JavaScript; const items = ;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.sleep(ms)
- Provides an async sleep for the given number of milliseconds.
-
Sleep for N milliseconds.
HTMLwaiting Send B5E30_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.sort
- [x] A function to be used with
Array.prototype.sort()that does a case insensitive sort on strings. - [x] The method's signature is
.sort(a, b)but is called without the params when used in an array.sort()call (i.e.items.sort(b.sort)).
-
Do a case insensitive sort of an array (updating the array itself)
HTMLwaiting Send FBF54_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.switch(subs)
- [x] bitty provides a default
b.templates.switchtemplate with HTML designed to be combined with custom CSS to produce a toggle switch. - [x] The
b.templates.switchvalue can be overwritten with another template. - [x] The
b.switch(subs)method renders an instance of the switch with the given substitutions. - [x] You can output the
b.templates.switchtemplate without any substitutions to see the raw template. - [x] The keys that can be substituted in the default template are:
__BACK_LABEL__- Text inside the label after the button.__CLASS__- Populates theclasson the label.__FRONT_LABEL__- Text inside the label in front of the button.__ID__- Populatesforon the label andidon the button.__KEY__- Populatesdata-key__RECEIVE__- Populatesdata-r__SEND__- Populatesdata-s__STATE__- Populatesaria-checked
- [x] An
__ID__gets automatically generated if one isn't passed in as a substitution. - [x] The
__STATE__is set to false if a substitution isn't provided. - [x] The default
__CLASS__isbitty-switch. - [x] Because the
data-keyattribute is on the button's parent label it can be used by both the button and the label (e.g. viael.prop("key")). - [x] The
aria-checkedvalue can be updated via thesenderargument in the signal function (i.e. fromexport function someSignal(ev, sender, el) {}.
-
Render a switch with no label.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Render a switch with a label in front.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Render a label after a switch.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Set a switch to 'on' while loading.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;NotesThis is the stylesheet that's used for the switch examples on this page and on the rest of the site.
view stylesheet
} } } } } } } } } } }
b.tee(input, log = true)
- The
b.tee()method is modeled after theteecommand line tool. - Input sent to see is returned without modification.
- By default, the input is also sent to
content.log. - The log output can be turned off by setting the second argument to
falseor0.
-
Return the input passed to tee while also logging it out to the console.
HTMLwaiting Send 78164_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.time(date = new Date())
- Outputs a timestamp in the format YYYY-MM-DDTHH:MM:SS for the current locale.
- The hour in
HHis based of a 24 hour clock (e.g. 3PM is15). - If a
Dateis passed to the function the output is based off it. - If no argument is provided the function uses
new Date()for the time.
-
Display the current time.
HTMLwaiting Send 010EE_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Display a specific time.
HTMLwaiting Send 05431_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;Notes- The purpose of this function is to provide a concise display of a time for the current locale. It is not a valid ISO 8601, RFC 3339, or RFC 9557 timestamp.
b.timeMs(date = new Date())
- Operates the same as
time()but adds milliseconds to the end of the string.
-
Display the current time with milliseconds.
HTMLwaiting Send 5415A_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Display a specific time with milliseconds.
HTMLwaiting Send 85842_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.trigger(signals)
- [x] Used to trigger a signal from inside another function.
- [x] Can trigger one single or multiple.
- [x] If a signal is triggered and there are corresponding receiver elements (i.e. they have a matching
data-rattribute), each one is processed individually (the process is the same as what happens withdata-s). - [x] The first argument passed to a triggered signal is a custom event with the type
bittytrigger. - [x] The internal details of the
bittytriggerevent type is an implementation detail with no public API and may change without notice. - [x] The second argument argument to a triggered signal that normally holds the sender is
undefined. - [x] If a signal is triggered and there's no corresponding receiver it is run a single time without an element passed to the third argument
(this is the same as
data-sas well). - [x] Triggers are sent as events that bubble up the DOM and processed individually by an bitty instance that has a corresponding function (i.e. there is no guarantee that the triggers will occur in the order they are added. Processing things in a given order can be done by triggering a single function at a time with each function calling the next one in the chain when it's done).
-
Trigger a signal from inside another function.
HTMLwaiting Send 9FE51_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Trigger multiple signals.
HTMLwaiting waiting Send 68843_v1JavaScript;Resultwaitingwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Triggered signals without a receiver fire once.
HTMLwaiting Send EC577_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
The incoming event type is `bittytrigger`. (Note that the internals of the event itself are private implementation details that may change without notice.)
HTMLwaiting Send 94F67_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
The second argument (i.e. the `sender` argument) is `null` from `.trigger()`.
HTMLwaiting Send 9BBC3_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
The third argument passed to a function from trigger is `null` if there is no corresponding receiver (i.e. element with a `data-r` that has the value of the signal).
HTMLwaiting Send 0D36A_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
b.uuid(dashes = true)
- [x] Generates a random UUID with
self.crypto.randomUUID(). - [] Passing
falsefor the optional argument removes the dashes from the UUID.
-
Get a standard v4 UUID.
HTMLwaiting Send B5C78_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Generate a 32 character string from a UUID with the dashes removed.
HTMLwaiting Send 26E12_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
default listeners
button
-
click a button
HTMLwaiting Send E5B7B_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
clickable elements
- [] non-form, non-contenteditable elements pass
click events by default when they have a
data-sattribute on them.
-
click div
HTMLwaiting Send 7E9F1_v1JavaScript; let activations = 0;ResultwaitingSend 7E9F1_v1view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
clicking a nested div only sends one signal
HTMLwaiting Send 7E96C_v1JavaScript; let activations = 0;ResultwaitingSend 7E96C_v1view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
click top div only sends one signal
HTMLwaiting Send A1A49_v1JavaScript; let activations = 0;ResultwaitingSend A1A49_v1view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
contenteditable
-
[] Elements with
contenteditablepassinputevents.It would be preferable to pass
changeevents. But, those aren't provided bycontenteditable.It's not possible to listen for
blurevents at the top of the DOM either. Those events don't bubble.For brief testing it looks like an
ev.inputType === "insertParagraph"check can be used as a proxy for when the enter key is hit that could stand in for achangeevent if the element should only provide a single line. That needs more investigation though.It's possible to listen for
blurevents by attaching the listener directly to an element. bitty doesn't try to do that because race conditions may occur when adding elements and trying to coordinate between multiple possible bitty instances on a page is outside of scope.
-
contenteditable sends input events by default
HTMLInput: Output: waitingJavaScript;ResultInput:Output:waitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
contenteditable elements can listen for click events
HTMLwaiting Send DD34F_v1 on clickJavaScript;ResultwaitingSend DD34F_v1 on clickview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
form
-
submit form
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: button
-
Clicking an `input type="button"` sends signals.
HTMLwaitingJavaScript; let activations = 0;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: checkbox
-
Tick a checkbox.
HTMLwaiting Send 7F250_v1JavaScript; let activations = 0;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Using the label works to update the checkbox and send the signals
HTMLwaiting Send 1B139_v1JavaScript; let activations = 0;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: color
-
Choose a color
HTMLwaitingJavaScript; const targetType = "change"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: date
-
date sends signals on `change` events.
HTMLwaitingJavaScript; const targetType = "change"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input local datetime
-
Test local datetime
HTMLwaitingJavaScript; const targetType = "change"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: email
-
Test input
HTMLwaitingJavaScript; const targetType = "keydown"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: file
-
Test input
HTMLwaitingJavaScript; const targetType = "change"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: image
-
Test input
HTMLwaitingJavaScript; const targetType = "click"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: month
-
Test input
HTMLwaitingJavaScript; const targetType = "keydown"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: number
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: password
-
Test input
HTMLwaitingJavaScript; const targetType = "keydown"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: radio
-
Test input
HTMLwaitingJavaScript; const targetType = "change"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: range
-
Test input
HTMLwaitingJavaScript; const targetType = "input"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: reset
-
Test input
HTMLwaitingJavaScript; const targetType = "click"; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: search
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: select
-
Test input
HTMLwaiting alfa bravo charlieJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: submit
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: tel
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: text
- Triggers for
inputtags withtype="text"are triggered when theEnterkey is pressed (via keyCode=13). - It does not respond to every character that's input.
Use
type="search"if you need to do that.
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: time
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: url
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: week
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
input: textarea
-
Test input
HTMLwaitingJavaScript; const targetTypes = ; let gotBadEvent = false;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
page assets
auto loaded page data
- [] data can be added directly to a page by including a string
of JSON in a
<script>tag with a type ofapplicaiton/jsonand anidattribute. - [] The data can be accessed from
b.data["id"]whereidis the value of theidattribute.
-
Auto load data from the page.
HTMLwaiting Send A4B07_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
auto loaded page SVGs
- [x] SVGs can be included on the page by placing them as the first
element inside a
<template>tag on the page with anidattribute. - [x] SVGs loaded this way are available in
b.svg["id"]whereidis the value of theidattribute.
-
Auto load SVGs from the page.
HTMLwaiting Send 24CEF_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
auto loaded page templates
-
Use an auto loaded template.
HTMLContent A6DC9_v1 waiting Send signal_A6DC9_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
module templates
module templates
-
Use templates from the module.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Templates from the page overwrite module templates.
HTMLwaiting Send from template 35974_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Templates from `.getTemplates()` overwrite module templates.
HTMLwaitingJavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
element methods
.aria(key)
- [x] Gets the
aria-keyvalue from the current element as a string if one exists. - [x] If the current element doesn't have the
aria-key, then it's pulled from an ancestor if it exists on one of them.
-
Get aria value as a string.
HTMLwaiting Send 7EB28_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Get the `aria-key` value from an ancestor if the current element doesn't have it.
HTMLwaiting Send C0635_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.ariaAsBool(key)
- [x] Gets the
aria-keyvalue from the current element as a boolean if one exists. - [x] If the current element doesn't have the
aria-key, then it's pulled from an ancestor if it exists on one of them.
-
Get aria value as boolean.
HTMLwaiting Send 11F44_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Get the value from an ancestor if it doesn't exist on the current element.
HTMLwaiting Send 46CF0_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.ariaAsFloat(key)
- [x] Gets the
aria-keyvalue from the current element as a float if one exists. - [x] If the current element doesn't have the
aria-key, then it's pulled from an ancestor if it exists on one of them.
-
Get aria value as a float.
HTMLwaiting Send 7AB43_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Get the value from an ancestor if it doesn't exist on the current element.
HTMLwaiting Send 4CD55_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.ariaAsInt(key)
- [x] Gets the
aria-keyvalue from the current element as a int if one exists. - [x] If the current element doesn't have the
aria-key, then it's pulled from an ancestor if it exists on one of them.
-
Get aria value as int
HTMLwaiting Send 3EC3E_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Get the value from an ancestor if it doesn't exist on the current element.
HTMLwaiting Send A70B4_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.copy()
- [x] Copies the contents of the
.targetfrom the incoming event to the operating system copy/paste board. - [x] The
.valueis copied if it exists. - [] Otherwise, the
.innerHTMLis copied.
-
Copy the `.value` of the incoming event's `.target` if it exists.
HTMLSend D81DD_v1JavaScript;Resultview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; // This example must be tested manually since // it deals with the operating system's // copy/paste system. -
Copy the contents of the .innerHTML.
HTMLContent from element AE5C9_v1 Send AE5C9_v1JavaScript;ResultContent from element AE5C9_v1view test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; // This example must be tested manually since it // deals with the copy/paste system of // the operating system.
.innerHTMLAsBool()
-
Get float from innerHTML
HTMLtrue waiting Send 4E481_v1JavaScript;Resulttruewaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.innerHTMLAsFloat()
-
Get float from innerHTML
HTML1.1 waiting Send F0485_v1JavaScript;Result1.1waitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Commas are removed and empty space is trimmed before parsing.
HTML9,000.1 waiting Send 69365_v1JavaScript;Result9,000.1waitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.innerHTMLAsInt()
-
Get innerHTML as an int.
HTML100 waiting Send C7219_v1JavaScript;Result100waitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Commas are removed and empty space is trimmed before parsing.
HTML9,000 waiting Send 43120_v1JavaScript;Result9,000waitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.prop(key)
- [x] Returns the value of a
data-KEYattribute as a string if it exist on the target. - [x] If there is no
data-KEYon the event target the method searches ancestors for the first one with adata-KEYattribute and returns its value. - [x] If neither the target element or any of its ancestors have a
data-KEYattribute thenundefinedis returned.
-
Get the value from a `data-KEY` attribute as a string.
HTMLwaiting Send 0C6A4_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return undefined if neither the event target or any of its ancestors have the requested `data-KEY` attribute.
HTMLwaiting Send A40D2_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.propAsBool(key)
-
Get element dataset property as a boolean.
HTMLwaiting Send 1AAB0_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.propAsFloat(key)
- [x] Returns the value of a
data-KEYattribute as a float if it exist on the target. - [x] If there is no
data-KEYon the event target the method searches ancestors for the first one with adata-KEYattribute and returns its value. - [x] If neither the target element or any of its ancestors have a
data-KEYattribute thenundefinedis returned.
-
Get the value of a `data-KEY` attribute as a float.
HTMLwaiting Send 9E204_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return undefined if neither the event target or any of its ancestors have the requested `data-KEY` attribute.
HTMLwaiting Send 046FC_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.propAsInt(key)
- [x] Returns the value of a
data-KEYattribute as a float if it exist on the target. - [x] If there is no
data-KEYon the event target the method searches ancestors for the first one with adata-KEYattribute and returns its value. - [x] If neither the target element or any of its ancestors have a
data-KEYattribute thenundefinedis returned.
-
TKTKTK: Test name
HTMLwaiting Send 1CD4F_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Return undefined if neither the event target or any of its ancestors have the requested `data-KEY` attribute.
HTMLwaiting Send B7ED7_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.setAria(key, value)
-
TKTKTK: Test name
HTMLwaiting Send E12AF_v1JavaScript;Resultview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Set the aria-key value of an ancestor if one exists.
HTMLwaiting Send 64DC0_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.setProp(key, value)
- [x] Sets or updates the
el.dataset.KEYto the specified value. - [] Sets the value of the first ancestor that has the dataset key if the current element does not have it.
-
TKTKTK: Test name
HTMLwaiting Send A090D_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
TKTKTK: Test name
HTMLwaiting Send 0019A_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
toggleAria(key)
- [x] Toggles the value of an
aria-attribute fromtrue,on,yes, or1to:false,off,no, or0, respectively. - [x]
.closest()is used to search for an existingaria-keyattribute on ancestors if the current element doesn't have it. The ancestor if updated if one is found. Otherwise, a newaria-keyattribute is added to the current element.
-
TKTKTK: Test name
HTMLwaiting Send 25E12_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
Toggle the aria value on a parent if the current element doesn't have they attribute.
HTMLwaiting Send D7E5C_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
toggleProp(key)
- [x] Toggles a dataset (prop) value from
true,on,yes, or1to:false,off,no, or0, respectively. - [x] The function uses
.closest()and will change the dataset on parent elements if the element itself doesn't have the property.
-
Toggle a dataset property.
HTMLwaiting Send 599B9_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript; -
If the current element doesn't have a data- attribute with the key, then toggle the value on an ancestor if one exists.
HTMLwaiting Send C7BF0_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.valueBool()
-
Get a boolean from a value
HTMLwaiting Send 72290_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.valueFloat()
- [x] Returns the
.valueof the incoming events.targetas a float.
-
TKTKTK: Test name
HTMLwaiting Send 02356_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
.valueInt()
- [x] Returns the
.valueof the incoming event's.targetas an integer.
-
Return the value as an integer.
HTMLwaiting Send 8B4F2_v1JavaScript;Resultwaitingview test harness
bitty tag for the examplebitty tag for the test verificationVerification JavaScript;
Release Notes
view release notes
v8.0.0.md
Version 8.0.0
May 8, 2026
-
Release - no changes since beta-8
v8.0.0-beta8.md
Version 8.0.0-beta-8
April 9, 2026
- Switched to using
data-templateinstead ofidon<script>templates (e.g.<script type="text/html" data-template="someName"></script>) to avoid possible conflict the ids on the page.
v8.0.0-beta7.md
Version 8.0.0-beta-7
April 7, 2026
-
Changed tag name from
<bitty-MAJOR-MINOR>to<bitty-MAJOR>since the API for the major version will stay the same. MINOR version updates just add features. The idea being that you won't implement features that your version of bitty doesn't have. -
Updated form input listeners for better defaults. Text style fields listen for the enter key.
type="search"listens for bothinputand the enter key. Other inputs listen forchangeevents. -
Renamed
b.get()tob.getData()for clarity. -
Reversed the arguments for
b.save()andb.savePage()so the value saved comes first then the key so it reads in the order of "Save Value as Key". This is different from the order oflocalStorage.setItem(key, value)That order feels less natural though. Putting the value first is also the way that indexedDB works. -
Switched backend for
b.save()and friends to from localStorage to IndexedDB. The methods use a default database and allow sending in key/value pairs. -
Renamed
b.save()tob.saveData()for clarity. -
Renamed
b.savePage()tob.savePageData()for clarity. -
Renamed
b.load()tob.loadData()for clarity. -
Renamed
b.loadData()tob.loadPageData()for clarity. -
Set the default for
b.mapKey()to not.preventDefaulton the event. It'll be up to the signal function to make that switch. (The option still exists to implement.prevendDefaultwhen defining theb.mapKey()through its options.) -
Renamed
.valueInt()to.valueAsInt()and similar for.prop...(),.aria...(), and.innerHTML...()with...AsBool()and...AsFloat(). -
Added
__SAVE__tob.switch()that outputsdata-save=""with the value if it exists. -
Added
b.deletePageData()to remove page specific data from the default IndexedDB object store. -
Added
b.deleteSiteData()to remove site wide data from the default IndexedDB object store. -
Updated the built in switch template so that it doesn't output empty
data-r,data-s, ordata-keyattributes if no values are provided for them. -
Added a
__LABEL_MISC__and__BUTTON_MISC__keys tob.switch()that lets you send an arbitrary payloads to the respective elements. -
Added
b.getState()which creates an object with selected attributes from elements on the page which have adata-save="true"attribute and anid. -
Added
b.setState()which takes an object created byb.getState()and restores the given attributes to the corresponding elements via theiridattributes. -
Added
b.configto hold configuration values. Currently, the config consists solely of the attributes forb.getState(). -
Renamed
b.deduptob.dedupebecause that's what I type every time. -
Added
b.forwardSenderto pass elements in thesenderslot (i.e. second argument) to another function. The impetus goal being to make it easier to initialize content that sends an event that would otherwise require some interaction (e.g. a click). -
Changed
nullarguments toundefinedwhen triggering signals without corresponding arguments so every check can be forundefinedinstead of having to make a decision about checking fornullin some cases andundefinedin others.
v8.0.0-beta6.md
Version 8.0.0-beta-6
March 19, 2026
-
Added SVG output to
.renderfrom templates inb.svgs. -
Added
b.addStyles(css)that creates an adopted stylesheet with thecssand attaches it to the document. -
Added
b.savePage(key, data)that forwards tob.save(key, data)after prepending the key with the.pathnamefor the page's URL the same wayb.loadPage()does. -
Added
b.loadPage(key, fallback)that works likeb.load()but prepends the key with the.pathnamefrom the page's URL to automatically associated it with the page. -
Renamed
b.restore()tob.load()for loading data from localStorage. -
Added tests to verify that templates can be added with
export const b = { templates: { } }and that they are overwritten by templates from the page or loaded with.getTemplates(). -
Added
b.switchwhich renders an HTML label and button with classes designed for a stylesheet to hook into to make it appear like a toggle switch. The template for the switch is stored inb.templates.switchso it can be overwritten. -
Moved additional bitty features from being placed on the
evevent to theev.targetelement itself. This keeps the API consistent acrossev.target,sender, andel. -
Renamed
.propAsFloat(key)to.propFloat(key). -
Renamed
.propAsInt(key)to.propInt(key). -
Added
.propBool(key)to get a dataset property as a boolean. -
Added
.toggleProp(key)which lowercases the value of andata-*attribute and if it'strue,on,yes, or1, then it toggles it tofalse,off,no, or0, respectively. The method uses.closest()to update the property either directly on the element or on an ancestor if one is available. -
Updated
.setProp(key, value)so that it searches ancestors for the dataset property if the current element doesn't have it. If an ancestor if found that has it, the ancestor's value gets updated. Otherwise, the element itself is given the dataset key with the value. -
Added
.valBool()to get the value of an element as a boolean. -
Renamed
.valAsFloat()to.valFloat() -
Renamed
.valAsInt()to.valInt() -
Added
.aria(key)toev,sender, andel. It returns the value fromaria-keyas a string. -
Added
.ariaBool(key)toev,sender, andel. It returns the value fromaria-keyas a boolean. -
Added
.ariaFloat(key)toev,sender, andel. It returns the value fromaria-keyas a float. -
Added
.ariaInt(key)toev,sender, andel. It returns the value fromaria-keyas an integer. -
The
.ariaXXX()methods use.closest()to pull the value from the current element or the nearest ancestor depending on what's available. -
Added
.setAria(key, value)toev,sender, andelto set the givenaria-keyattribute on an element. -
The
.setAria(key, value)will search for ancestor elements with the given ariakeyif the current element doesn't have it. It will set the aria value ancestor if it finds one. Otherwise, it sets the value on the element itself. -
The
.ariamethods use.closest()to search parent elements for an aria value if the current element doesn't have on. -
Added
.toggleAria(key)which lowercases the value of anariavalue and if it'strue,on,yes, or1, then it toggles it tofalse,off,no, or0, respectively. -
When
true,false, andnullare passed to a find/replace in.renderthey are turned into strings for the output. -
When numbers are passed to a find/replace in
.renderthey are turned into strings for the output. -
Removed
.isSenderand.isTarget. It's just as easy to do something likesender === eland removes the complexity of trying to maintain the state during function calls. -
Set up
.innerHTMLAsBool()as a method. -
Set up
.innerHTMLAsFloat()as a method. -
Set up
.innerHTMLAsInt()as a method. -
Removed
.val()in favor of just using.value. The original goal of having.val()was to maintain consistency with.valueAsBool(), etc.. so they were all methods. With this move,.valueis a property. The rest are methods. That adds a little friction having to remember which one is which. But, it reduces it by using the native.value. The later being more beneficial than the former was detrimental. -
Updated
b.mark()andb.getMarks()so it's a single level array insteadf of an array of arrays. (The original idea was to provide a place to pass notes along with the benchmarks. That requires more processing when using the marks since you have to dig into the nested array. It's less friction to keep everything at the top and use naming of the keys or some other indexing.)
v8.0.0-beta5.md
Version 8.0.0-beta-5
March 14, 2026
-
Added
b.quickCopy(el, sender, options)that provides a default copy function for a button. It copies the.valueor.innerHTMLfrom theel. It updated the.innerHTMLofsendertoCopiedby default. It debounces interactions with the button and restores thesendertext to its original value when the debouncer resolves. -
Refined default listeners for form controls (e.g.
<input type="text" />don't send signals fromclickevents). See thedefault listenerssection of the docs for details on all the elements. -
Moved
b.initrunner after the listeners are set up to ensure things get picked up properly on initial load. (e.g.b.send()works as expected if it's in a function run fromb.init) -
Renamed
loadDatatoget. -
Renamed
loadTemplatestogetTemplates. -
Added
b.randomInt(min, max)to get a random integer between theminandmax(inclusive of theminandmaxnumbers themselves) -
Added
b.randomFloat(min, max)to get a random float between theminandmax(inclusive of theminandmaxnumbers themselves) -
Added
b.ceas an alias fordocument.createElement();
v8.0.0-beta4.md
Version 8.0.0-beta-4
March 11, 2026
This was a fundamental overhaul that change from using a class based system to using functions.
Details
-
Modules are still connected to via a
data-connectattribute on a<bitty-8-0>tag. -
bitty modules must export
bobject like:export const b = {}that bitty connects to. -
Instead of using
data-runon a<bitty-8-0>to send initial signals aninitkey can be added to the exportedbobject like:export const b = { init: "signal1 signal2" } -
The
ev.senderhas been removed from events and is sent as its own argument. -
The signature for signal functions is now:
export function signalName(ev, sender, el) {} -
The
data-sendattribute has bee renamed todata-s. -
The
data-receiveattribute has bee renamed todata-r. -
The
data-listenerattribute has bee renamed todata-listen. -
The list of function available on the
bbitty object is:- addListener
- copy
- debounce
- dedup
- getMarks
- innerHTMLAsFloat
- innerHTMLAsInt
- loadData
- loadTemplates
- mapKey
- mark
- modKeyAliases
- qs
- qsa
- render
- restore
- save
- send
- setCSS
- sleep
- sort
- tee
- time
- timeMs
- trigger
- uuid
See the documentation for details on each.
-
<script>tags can be used as data blocks directly on the page to provide templates by setting their type totext/htmland providing anidattribute. -
<script>tags can be used as data blocks directly on the page to provide data by setting their type toapplication/jsonand providing anidattribute. -
<script>tags can be used as data blocks directly on the page to provide SVGs by setting their type toimage/svgand providing anidattribute. -
Events sent as the first argument have the following additional features:
- copy
- prop
- propAsFloat
- propAsInt
- setProp
- val
- valAsFloat
- valAsInt
See the documentation for details on each.
-
The
senderelement sent as the second argument to signal functions has the following additional features:- copy
- prop
- propAsFloat
- propAsInt
- setProp
- val
- valAsFloat
- valAsInt
See the documentation for details on each.
-
The
elelement sent as the third argument to signal functions has the following additional features:- copy
- isSender
- isTarget
- prop
- propAsFloat
- propAsInt
- setProp
- val
- valAsFloat
- valAsInt
See the documentation for details on each.
-
Divided details on how to use bitty into four categories:
-
snippets - for short pieces of code that are like Lego blocks.
-
examples - which are complete applications of bitty with varying complexity.
-
documentation - which is the details and tests for each of bitty's features.
-
tutorials - walk-throughs of how to build different features and apps with bitty.
-
v8.0.0-beta3.md
Version 8.0.0-beta-3
DATE N/A
Unreleased prototype with undocumented changes that are obviated in beta-4.
v8.0.0-beta2.md
Version 8.0.0-beta2
DATE N/A
Unreleased prototype.
This is a complete overhaul of the bitty approach. Instead of wrapping other elements in a bitty tag, it's added independently somewhere on the page. Functionality is pulled in and everything on the page can both send and receive.
The documentation has been updated with all the functionality (listing it here would simply be repeating the docs).
v8.0.0-beta1.md
Version 8.0.0-beta-1
DATE N/A
Unreleased prototype with these changes
-
Added
this.api.sleep(MS)function that sleeps for a number of milliseconds viaawait this.api.sleep(MS). -
Added
this.api.htmlTemplate(KEY, SUBS)that is an alias for:this.api.makeHTML(this.api.template(KEY), subs)) -
Added
this.api.elementTemplate(KEY, SUBS)that is an alias for:this.api.makeElement(this.api.template(KEY), subs)) -
Added
this.api.svgFromTemplate(KEY, SUBS)that is an alias for:this.api.makeSVG(this.api.template(KEY), subs)) -
Added feature that loads any
<script></script>tags withtype="application/json"and anid="ID"attribute into a data store available inthis.api.data(ID)after passing it throughJSON.parse(). -
Added feature that loads any
<script></script>tags withtype="text/html"and anid="ID"attribute into a set of plain text templates available inthis.api.template(ID). -
Added feature that loads any
<script></script>tags withtype="text/plain"and anid="ID"attribute into a set of plain text templates available inthis.api.template(ID). -
Added
el.copyText()which copies the text of and element to the copy/pasteboard. If the element has ael.value(e.g. it's from a form input), the value gets copied. Otherwise it copies theinnerHTMLfrom the element. -
Added
el.setProp(KEY, VALUE)that adds or updates adataset-KEYvalue on anel. If the value already exists and hasn't changed no update is made. -
Updated the bitty-#-# tag so it can receive signals via
data-receive. -
Renamed
this.api.getTXT()tothis.api.getTEXT()so it's the actual word and has better separation from the extension (e.g. you could pull a .html file as TEXT) and better matchesthis.api.getHTML()etc... -
Renamed
this.api.makeTXT()tothis.api.makeTEXT()so it's the actual word and has better separation from the extension (e.g. you could pull a .html file as TEXT) and better matchesthis.api.getHTML()etc... -
Renamed
this.api.setProp(KEY, VALUE)tothis.api.setCSS(KEY, VALUE)to avoid confusion withel.setProp(KEY, VALUE). -
Renamed
...ToInt()to...AsInt()for clarity. -
Renamed
...ToFloat()to...AsFloat()for clarity. -
Deprecated and removed
data-use. It added too much mental overhead since it created a different send/receive mode that only affected a single element. That can be done with the various.matchXXXmethods in a way that's simpler to reason about. -
Deprecated and removed
data-init. It was more confusing to work with than just usingdata-sendanddata-receiveand usingbittyReady()to run things for initialization.
v7.0.0.md
Version: 7.0.0
Dec. 10, 2025
-
Version 7.0.0 release.
-
No changes since
7.0.0-rc2.
v7.0.0-rc2.md
Version: 7.0.0-rc2
Dec. 7, 2025
This change primarily moves .target and
.sender items from el to ev.
And moves the sending element into
ev.sender with extra the features added.
-
Renamed
ev.valtoev.value -
Renamed
ev.valInttoev.intValue -
Renamed
ev.valFloattoev.floatValue -
Renamed
ev.dstoev.prop -
Renamed
ev.dsInttoev.propToInt -
Renamed
ev.dsFloattoev.propToFloat -
Added
ev.sender.value -
Added
ev.sender.valueToInt -
Added
ev.sender.valueToFloat -
Moved
el.targetBittyIdtoev.bittyId -
Renamed
el.dstoel.prop -
Renamed
el.dsInttoel.propToInt -
Renamed
el.dsFloattoel.propToFloat -
Removed
el.targetDs()in favor of existingev.prop() -
Removed
el.targetDsInt()in favor of existingev.propToInt() -
Removed
el.targetDsFloat()in favor of existingev.propToFloat() -
Moved
el.senderBittyIdtoev.sender.bittyId -
Removed
el.senderDs()in favor of existingev.sender.prop() -
Removed
el.senderDsInt()in favor of existingev.sender.propToInt() -
Removed
el.senderDsFloat()in favor of existingev.sender.propToFloat() -
Removed
el.valin favor of the standardel.value -
Renamed
el.valInttoel.valueToInt -
Renamed
el.valFloattoel.valueToFloat -
Removed
el.targetValin favor ofev.value -
Removed
el.targetValIntin favor ofev.valueToInt -
Removed
el.targetValFloatin favor ofev.valueToFloat -
Removed
el.senderValin favor ofev.sender.value -
Removed
el.senderValIntin favor ofev.sender.valueToInt -
Removed
el.senderValueFloatin favor ofev.sender.valueToFloat -
Renamed
el.matchTargetDstoel.propMatchesTarget -
Renamed
el.matchSenderDstoel.propMatchesSender -
Fixed bug where
el.isSenderwas checking againstel.senderinstead ofev.sender. -
Removed deprecated
el.sendercode. -
Fixed bug where forwared signals required a receiver. They now fire once if there isn't a receiver the same way
data-sendworks. -
The
bittyelement is used as theev.senderon athis.api.tigger(SIGNAL)call (previously, anullvalue was sent) -
Removed
el.bittyParentBittyId. Usethis.api.bittyIdorel.bittyParent.bittyIdinstead. -
Refactored to use centralized processEvent method.
v7.0.0-rc1.md
Version: 7.0.0-rc1
This update is a largely a set of API refinements to make things more obvious and consistent.
It also adds data-use which allows an element
to send a signal that only it uses.
-
Improved error messages with more details when connections can't be made.
-
Renamed the
bitty-#.#.#.min.jsfile tobitty-#.#.#.jsto highlight that it's the one that should be used in production. -
Renamed the
bitty-#.#.#.full.jsfile tobitty-#.#.#.dev.jsfor clarity that it's the source code and not what should be used in production. -
TODO: Added
this.api.makeSVGwhich takes a text string and turns it into an SVG. -
Moved
bittyInitback to inline instead of running as an event to allow properasync/awaitfunctionality. -
Moved
bittyReadyback to inline instead of running as an event to allow properasync/awaitfunctionality. -
Added
data-usewhich sends a signal from an element which is only processed by the element itself (e.g. if there are several elements with the samedata-useordata-sendvalues the other aren't processed). This means you don't have to check.isSenderorisTargetif you don't need to update other elements from a signal. (You'd still need them for doing different things when every element needs to be updated differently depending on if it's the sender/target or not.)The
data-useattribute picks up events from child element the same waydata-senddoes. -
Moved
ev.sendertoel.senderThe sender element is no longer appended to the event. It's added to the element instead so that all general usage can be done through the element (e.g.el) argument. -
Renamed
el.getString(KEY)toel.ds(KEY) -
Renamed
el.getInt(KEY)toel.dsInt(KEY) -
Renamed
el.getFloat(KEY)toel.dsFloat(KEY) -
Removed
ev.target.getString(KEY) -
Added:
el.targetDs(KEY) -
Removed
ev.target.getInt(KEY) -
Added:
el.targetDsInt(KEY) -
Removed
ev.target.getFloat(KEY) -
Added:
el.targetDsFloat(KEY) -
Removed
ev.target.stringValue(KEY) -
Added:
el.targetVal(KEY) -
Removed
ev.target.intValue(KEY) -
Added:
el.targetValInt(KEY) -
Removed
ev.target.floatValue(KEY) -
Added:
el.targetValFloat(KEY) -
Removed
ev.sender.getString(KEY) -
Added:
el.senderDs(KEY) -
Removed
ev.sender.getInt(KEY) -
Added:
el.senderDsInt(KEY) -
Removed
ev.sender.getFloat(KEY) -
Added:
el.senderDsFloat(KEY) -
Removed
ev.sender.stringValue(KEY) -
Added:
el.senderVal(KEY) -
Removed
ev.sender.intValue(KEY) -
Added:
el.senderValInt(KEY) -
Removed
ev.sender.floatValue(KEY) -
Added:
el.senderValFloat(KEY) -
Added
el.val -
Added
el.valInt -
Added
el.valFloat -
Added
el.targetBittyId -
Added
el.senderBittyId -
Renamed
el.bittyParentIdtoel.bittyParentBittyIdto be consistent with other...BittyIdproperties. -
Renamed
el.matchTarget(KEY)toel.matchTargetDs(KEY) -
Renamed
el.matchSender(KEY)toel.matchSenderDs(KEY) -
Added
ev.valthese are for when a method is run without a receiver and the target is an input. -
Added
ev.valIntthese are for when a method is run without a receiver and the target is an input. -
Added
ev.valFloatthese are for when a method is run without a receiver and the target is an input. -
Added
ev.ds(KEY)these are for when a method is run without a receiver and the target is an input. -
Added
ev.dsInt(KEY)these are for when a method is run without a receiver and the target is an input. -
Added
ev.dsFloat(KEY)these are for when a method is run without a receiver and the target is an input. -
Added
el.ds(KEY)which is an alias toel.dataset.keywhich gets returns as a string. -
Added
el.senderDs(KEY)which is an alias toel.sender.dataset.keywhich gets returns as a string. -
Added
el.targetDs(KEY)which is an alias toev.sender.dataset.keywhich gets returns as a string. -
Improved error message when
data-connectdoesn't make a connection.
v6.0.0-rc3.md
Version: 6.0.0-rc3
DATE TBD
-
Added
event.target.stringValuethe returns theevent.target.valueas a string. (this is effectively an alias that's only here to keep the mental model with.intValueand.floatValueconsistent) -
Added
event.target.intValuethe returns theevent.target.valueas an integer. -
Added
event.target.floatValuethe returns theevent.target.valueas an float. -
Added
event.sender.stringValuethe returns theevent.sender.valueas a string. (this is effectively an alias that's only here to keep the mental model with.intValueand.floatValueconsistent) -
Added
event.sender.intValuethe returns theevent.sender.valueas an integer. -
Added
event.sender.floatValuethe returns theevent.sender.valueas an float. -
Added
event.target.getString(KEY) -
Added
event.target.getInt(KEy) -
Added
event.target.getFloat(KEY) -
Added
event.sender.getString(KEY) -
Added
event.sender.getInt(KEY) -
Added
event.sender.getFloat(KEY) -
Added
el.matchTarget(KEY)Note that there is no string/int/float because the values are always stored as strings so the comparison doesn't have to convert them since it would just be the same thing anyway -
Added
el.matchSender(KEY)Note that there is no string/int/float because the values are always stored as strings so the comparison doesn't have to convert them since it would just be the same thing anyway -
Remove setting
style="display: block;". Leaving this as a decision at implementation time.
v6.0.0-rc2.md
Version: 6.0.0-rc2
Nov. 25, 2025
-
Updated the
data-connectprocess so that URLs that start with a/get updated with the origin of thewindow.location.hrefto avoid issues when using CDNs for thebitty-#.#.#...file.At this time, relative URLs that start with a
.are not yet supported.
v6.0.0-rc1.md
Version 6.0.0-rc1
Nov. 24, 2025
-
Updated license to CC0 for the public domain.
-
Added
this.api.getBittyParent(el)that returns the bitty element that contains theelelement. If theelelement is a bitty tag it returns itself. -
Added
data-bittyidattrs to everything so they can be used for comparisons. -
Events are captured from every element (not just those with
data-sendanddata-receive). Events bubble up the document where bitty looks for them on the window object. -
For the bitty events, the target that the event happened on and then the
senderthat is the element that had thedata-sendon it are both included. (e.g.event.targetis where the event happened atevent.senderi the element withdata-sendthat sent the signal. Theevent.targetandevent.senderwill be the same element if theevent.targetis what had thedata-sendattribute. Otherwise, they are different. -
Added
el.bittyParentthat contains a reference to the bitty parent element -
Added
el.bittyParentIdthat contains a reference to the bitty parent element's data-bittyid -
Removed
this.api.match()in favor ofel.isTargetandel.isSender. (this.api.matchTarget()andthis.api.matchSender()existed briefly but were also removed as part of the transition toel.isTargetandel.isSender. -
Added
el.isTarget()which is boolean that indicates if the element is the one that generated the event. -
Added
el.isSender()which is boolean that indicates if the element is the one withdata-sendthat sent the event (which may or may not be the same as the target identified byel.isTarget() -
Events bubble up until they hit an element with a
data-sendattribute. (e.g. you can click an element that doesn't have adata-sendattribute that's inside a div that does and the one from the div will fire) -
Renamed
data-sendtodata-initon the<bitty-#-#>tags to matchdata-initbehavior on child elements (i.e. only fires once when the element is initialized) -
data-sendattributes on<bitty-#-#>elements now send events (e.g. from clicks) the same way they do for child elements. -
Converted
bitty...pseudo-events to classes extended fromEvent. All events are set to bubble up the document. -
Created
this.api.localTrigger(SIGNAL_STRING)that only sends the signal to the local element without bubbling and without descending into child bitty elements. -
Added
el.getString(KEY)which goes up the DOM looking for a matchingdataset.KEYthat's a String. -
Added
el.getInt(KEY)which goes up the DOM looking for a matchingdataset.KEYthat's an Int. -
Added
el.getFloat(KEY)which goes up the DOM looking for a matchingdataset.KEYthat's a Float. -
Removed
bittyCatch()functionality. It's not necessary now that all events are examined by this listener without extra filtering. -
Removed adopted stylesheet to set `` to block. This saves loading duplicate stylesheets for each instance.
Using
thie.style.displayto set element to block. That way it can be changed easier by editing the style directly (e.g. by updated the style in thebittyInitfunction) -
Cleaned up tests
v5.1.0-rc6.md
Version: 5.1.0-rc6
Nov. 22, 2025
- Fixed bug where Text Nodes didn't
work properly with replaceAll in
this.api.makeHTML(), etc...
v5.1.0-rc5.md
Version 5.1.0-rc5
Nov. 22, 2025
-
Set up
this.api.trigger(SIGNAL)to send event that bubbles up to the document root -
Set up
this.api.forward(EVENT, SIGNAL)to send event that bubbles up to the document root -
Set up so
data-bittyidattrs are added on connectedCallback instead of at each event call. -
Set up so
data-bittyidattrs are added onthis.api.makeElement() -
Set up so
data-bittyidattrs are added onthis.api.getElement() -
Set up so
data-bittyidattrs are added onthis.api.makeHTML() -
Set up so
data-bittyidattrs are added onthis.api.getHTML() -
The net result is the
data-bittyidupdates is that anything added with thethis.api.WHATEVERthat has adata-send,data-receive, ordata-init, will have adata-bittyidadded. Anything that's added outside the API won't, event if it has one of the bittydata-*attributes.(The prior behavior was to look query for elements with
data-*attrs on every event. This was the first approach to deal with mutation observer having a race condition when trying to add them. Doing everything explicitly through the API prevents thrashing for things like moving input range sliders)
v5.1.0-rc4.md
Version: 5.1.0-rc4
Nov. 21, 2025
- Refactor to process elements with
data-receivedirectly instead of adding them to a list that gets processed as a batch.
v5.1.0-rc3.md
Version: 5.1.0-rc3
Nov. 20, 2025
-
Added the ability to convert single HTML Elements to text for find and replace in
makeTXT() -
Added the ability to convert arrays of HTML Elements to text for find and replace in
makeTXT() -
Added the ability to convert single Document Fragments to text for find and replace in
makeTXT() -
Added the ability to convert arrays of Document Fragments to text for find and replace in
makeTXT() -
Added the ability to convert arrays of String to text for find and replace in
makeTXT() -
Added the ability to convert single HTML Elements to text for find and replace in
makeHTML() -
Added the ability to convert arrays of HTML Elements to text for find and replace in
makeHTML() -
Added the ability to convert single Document Fragments to text for find and replace in
makeHTML() -
Added the ability to convert arrays of Document Fragments to text for find and replace in
makeHTML() -
Added the ability to convert arrays of String to text for find and replace in
makeHTML() -
Added the ability to convert single HTML Elements to text for find and replace in
makeElement() -
Added the ability to convert arrays of HTML Elements to text for find and replace in
makeElement() -
Added the ability to convert single Document Fragments to text for find and replace in
makeElement() -
Added the ability to convert arrays of Document Fragments to text for find and replace in
makeElement() -
Added the ability to convert arrays of String to text for find and replace in
makeElement() -
Added the ability to convert single HTML Elements to text for
getTXT() -
Added the ability to send HTML elements as substitutions for
getElement(). -
Added the ability to send HTML elements as substitutions for
getHTML(). -
Added the ability to send Document Fragments as substitutions for
getElement(). -
Added the ability to send Document Fragments as substitutions for
getHTML(). -
Added the ability to send Arrays of HTML elements as substitutions for
getElement(). -
Added the ability to send Arrays of HTML elements as substitutions for
getHTML(). -
Added the ability to send Arrays of Document Fragments as substitutions for
getElement(). -
Added the ability to send Arrays of Document Fragments as substitutions for
getHTML(). -
Added
data-initfor elements that fires a signal that they receive when bitty first initializes. -
Only add
data-bittyidto elements that have adata-send,data-receive,data-initattributes. -
Stopped adding
bittyidwith UUID from events. -
Removed
data-ralias fordata-receive. Better to have things be explicit and only have a single way to do it. (data-swas removed in-rc2)
v5.1.0-rc2.md
Version: 5.1.0-rc2
Nov. 17, 2025
-
Removed mutation observer and querying data-receive directly to prevent race condition on events.
-
Removed
data-salias fordata-send. Better to have things be explicit and only have a single way to do it.
v5.1.0-rc1.md
Version: 5.1.0-rc1
Nov. 13, 2025
-
Added
bittyReady()call that works likebittyInit()but happens afterthis.runSendFromComponent(); -
If
bittyReady()is defined as async (i.e.async bittyReady()) it's called withawait -
Added
this.api.trigger(signal)which works likethis.api.forward(null, signal). The event type isbittytrigger -
With
this.api.trigger(signal)usingthis.api.forward(event, signal)witheventset tonullis now an error. It's explicitly for forwarding an existing event. -
Added
await:signaltodata-sendandthis.api.forward(event, "await:signal"), andthis.api.trigger("await:signal")to await async methods. -
Added
makeTXT()which returns a text value from a template after running substitutions over it. -
Refactored
makeHTML()andmakeElement()to usemakeTXT() -
Added
data-salias fordata-sendanddata-ralias fordata-receive
v5.0.0.md
Version 5.0.0
Nov. 7, 2025
This is a collection of renames for clarity
and to help avoid collisions with
other code that might add data- attributes.
No actual functionality is changed, but
the renames require a version number
bump.
-
Renamed
getElementstogetHTMLfor clarity. (getElementremains the same and pulls individual HTML elements vsgetHTMLwhich pulls document fragments.) -
Renamed
makeElementstomakeHTMLfor clarity. (makeElementremains the same and makes individual HTML elements vsmakeHTMLwhich makes document fragments.) -
Renamed
response.oktoresponse.valuefor clarity and to avoid confusion with things likeresponse.ok === false. (i.e.response.value === falsetakes less mental overhead) -
Renamed
data-uuidtodata-bittyidto namespace and prevent collisions with anything else the wants to usedata-uuid
v4.0.0.md
Version: 4.0.0
Nov. 6, 2025
- Bumping the version number. No changes since v4.0.0-rc1.
v4.0.0-rc1.md
Version: 4.0.0-rc1
Oct. 30, 2025
-
Renamed
this.api.getFragmenttothis.api.getElements(this is a breaking change so it's a major version bump) -
Renamed
this.api.makeFragmenttothis.api.makeElements(with thethis.api.getFragmentchange) -
Added
bittyCatch(event)that catches any events that don't have a.target.dataset.sendvalue. This provides a way to catch message like from.postMessage()and decided what to do with them. -
Removed the
this.api.fnset up. It's not worth the overhead compared to just using functions directly. -
Using a space instead of a
|to separate signals and class names. This mimicsclass="some things"from CSS and is easier to type. Each keys must be a set of characters without spaces so there's no need for an explicit|. -
Changed listeners to be on the window to catch things like
.postMessage(). TODO: Make sure that's cool to listen on the window instead of the document. -
Changed internal use of
event.target.dataset.forwardkey forthis.api.forwardtoevent.bitty.forwardto avoid collisions on theevent.target.dataset -
Fixed bug in
this.api.forwardwhere an event that doesn't have a.targetor.target.datasetgets overridden. -
UUID are added to events that are being forwarded if they don't already exist.
-
Migrated docs site to use variables to make it easier to upgrade versions moving forward.
v3.0.0.md
Version: 3.0.0
Oct. 26, 2025
This isn't a huge jump from Version 2.x, but there are breaking changes so it gets a new number. These are quality of life improvements that make it easier to get external content while providing better errors if something goes wrong.
The details:
-
Did the following renames and additions for consistent API names for getting and adding documet fragments and elements:
-
Renamed
this.api.getHTML()tothis.api.getFragment()which pulls in an external file and returns it as a document fragment. -
Added
this.api.getElement()which pulls in an external file and retuns it as a single HTML Element (if there's more than one node at the top of the file only the first one gets returned). -
Renamed
this.api.useTemplate()tothis.api.makeFragment()which takes a string to use as a template and returns a document fragment. -
Added
this.api.makeElement()which takes a string to use as a template and returns a single HTML Element.
-
-
TODO: Added
getCSS()which pulls an external CSS file and loads it into the document as an adopted stylesheet. -
Added custom BittyError class for better error handling with
this.api.getTHINGcalls that use.fetchand for JSON parsing errors. -
When returning values from fetches return an object with either
{ ok: PAYLOAD }, or{ error: { /* details */ } }with extra data coming down in the error object like status codes for HTML errors. -
Added
connectedMoveCallback()to preventconnectedCallback()from firing if a component is moved. -
Moved everything in the init into the conditional check to see if the component makes a connection to a class. Previous a few things happend prior to the connection attempt. Moving them in prevents UUIDs from being added until a conneciton has been made. Shouldn't make any real difference. It just feels more natural.
-
Added and refined the test suite for increased coverage.
v2.0.0-rc2.md
Version: 2.0.0-rc2
Oct. 21, 2025
-
Properly returned
undefinedif there's a problem pulling an external HTML from getHTML(). -
Properly returned
undefinedif there's a problem pulling an external JSON from getJSON(). -
Properly returned
undefinedif there's a problem pulling an external SVG from getSVG(). -
Properly returned
undefinedif there's a problem pulling an external TXT from getTXT().
v2.0.0-rc1.md
Version: 2.0.0-rc1
Oct. 19.2025
-
Renamed
this.api.fetchJSON()tothis.api.getJSON()to match case used withJSON.stringify(), and switch fromfetchtogetprelude. -
Added substitutions param to
this.api.getJSON(url, subs=[])so all.getTHING(url, subs=[])methods have the same behavior. -
Added
options={}tothis.api.getJSON()to pass options to the fetch call. The signature isthis.api.getJSON(url, subs=[], options={}). -
Added
this.api.getHTML(url, subs=[], options={})that loads an HTML file and does find replace withsubson the initial string wheresubsis an array of arrays with the patterns to match and replace. The patterns can be strings or regex. -
Added
this.api.getSVG(url, subs=[], options={})that loads an SVG file and does find replace withsubswhich is an array of arrays with the patterns to match and replace. The patterns can be strings or regex. -
Added
this.api.getTXT(url, subs=[], options={})that returns the text content of an external file. -
Switched to array or arrays for find replace strings for
this.api.useTemplate(templateString, subs=[])and defaulting to an empty array so the argument doesn't have be sent which is consistent with the.getTHING(url, subs=[]) -
Added an adoptedStylesheet that sets the
<bitty-x-x>tag todisplay: block. -
Added
this.api.match(event, el, key=""). If a key exists, it's used to check thedatasetof theeventand theeland returns true if they match. If nokeyis provided theuuidof theeventandelare compared instead. -
Allowing whitespace around
data-sendattributes. -
Allowing whitespace around
data-receiveattributes. -
Added
.useHTML(content, subs = [])that converts a string fromcontentinto an HTML template (doing the substitutions) then returns the first element from it as an HTML element instead of a document fragment. -
Ingesting
window.bittyFunctionsfrom the page andconst functionsinside the module and providing access the them viathis.api.fn.FUNCTION() -
Ingest local
const functionsfunctions from the bitty component file that get added asthis.api.fn.FUNCTION() -
Ingested functions are bound with
.bind()so that theirthis.is the bitty component's element itself. -
Combined
this.configandthis.metadatain theconstructor().
v1.3.0.md
Version: 1.3.0
Oct. 13, 2025
- Releasing v1.3.0. No changes from v1.3.0-rc1.
v1.3.0-rc1.md
Version: 1.3.0-rc1
Oct. 6, 2025
-
Added
fetchJson(url)method which can be called withthis.api.fetchJson(url). Returns the data object if everything works. Otherwise, throws an error and returnsundefined. -
Added
useTemplate()to assemble a example while doing a find and replace of text
v1.2.0-rc1.md
Version: 1.2.0-rc1
Oct. 6, 2025
-
When using
data-connectif the value matches a class on the window object it's used. For example:data-connect="ExampleClass"connects towindow.ExampleClass.Previously, the class had to be in a
window.bittyClassesobject (e.g.window.bittyClasses = { ExampleClass: class {} };
v1.1.0-rc2.md
Version: 1.1.0-rc2
Oct. 6, 2025
- Updated console error message if no class to connect to can be found.
v1.1.0-rc1.md
Version: 1.1.0-rc1
Oct. 4, 2025
-
<bitty-COMPONENT_VERSION>can be called without adata-connectattribute. When it is, it looks for awindow.BittyClasson the page and uses it if it's available. -
Removed .error() method in favor of calling
console.error()directly in order to get useful line numbers.
v1.0.0.md
Version: 1.0.0
Oct. 4, 2025
-
Moved
v1.0.0-rc5tov1.0.0 -
Tag name is
<bitty-1-0>
v1.0.0-rc5.md
Version: 1.0.0-rc5
Oct. 4, 2025
-
Fixed bug with events not being passed to signal processing.
v1.0.0-rc4.md
Version: 1.0.0-rc4
Oct. 1, 2025
-
Renamed
<bitty-js>component tag to<bitty-MAJOR_VERSION>for semantic versioning. -
Call
bittyInit()withawaitif it's anasyncfunction. -
Moved
bittyInit()before thedata-sendcalls from the component so the module can set things up before the signals start being sent. -
Allowing
this.api.forward()to be called with anullevent (e.g.this.api.forward(null, "anotherFunction");). This is done to allow things like forwarding a signal frombittyInit()or any other function where there isn't an event to pass along. -
Fixed bug where new receivers weren't being added properly when they were child nodes of new nodes being added (and the top layer didn't have a
data-attr in it) -
Added tests for
this.api.querySelector()anddocument.querySelector() -
Update site to use variables for version numbers to make them easier to maintain instead of having them in multiple places for different displays.
-
Made
this.metadataan object and movedversioninto it (along withcopyrightandlicense)
v1.0.0-rc3.md
Version: 1.0.0-rc3
Sept. 23, 2025
-
Fixed bug where
this.api.send()would update thedata-sendattribute on the original element so it no longer send the same signal. The method is now calledthis.api.forward(). -
Removed
data-watch. Any element can receive a signal from anywhere else on the page without extra overhead. The biggest negative to this approach is that you have to be a little more careful to avoid naming collisions. But, the ease of use is well worth that minor trade off. -
Added Test Suite Results Report to site for easier viewing.
-
Applying passed and failed colors to individual tests for quicker scanning.
-
Updated tests to use unique signal names to avoid collisions.
v1.0.0-rc2.md
Version: 1.0.0-rc2
Sept. 19, 2025
-
data-watchis applied tobitty-jselements directly instead of individual elements. The signals are send back down the tree when one is received viadata-watch -
Refactored multiple UUID() calls to single function to save a few characters.
v1.0.0-rc1.md
Version: 1.0.0-rc1
Sept. 18, 2025
Initial release candidate for version 1.0.0.
No changes since v0.4.0.
v0.4.0.md
Version: 0.4.0
Sept. 17, 2025
-
Flipped module arguments from
example(el, event)toexample(event, el)since that lines up better with the order of send/receive. (i.e. theeventis what gets sent fromdata-sendand theelis the element fromdata-receive -
Remove HTML output of error message. They're nice during debug but wouldn't want them showing up in prod. Could use a
debugflag but that's more overhead than I want to add. So, message just go to the console.
v0.3.0.md
Version: 0.3.0
Sept. 17, 2025
Big refactor based on experience using 0.2.0.
-
Added more generic error handing where you just send a message and it outputs to the page along with the UUID of the element that had the problem. The elements have
bitty-js-errorstyle classes on them so their display can be controlled via CSS. -
Updated to use the name
data-connectinstead ofdata-module -
The
data-connectcan point to either a module or to a class in a globalbittyClasseswindow object. -
Alternate module classes are selected by passing a
|followed by the desired class name instead of usingdata-use. (e.g.data-connect="./module.js|AltClass) -
If there's an
bittyInit()function in a module it's the first thing that gets called once bitty is loaded. -
Removed
data-call. Thedata-sendattribute is used for everything. Nothing would fire from it in prior versions if there wasn't at least one element with adata-receivewith the same name. Now it calls the function once with no element if there's no associateddata-receive -
Added test suite.
-
The biggest update is changing
data-b,data-c,data-r, anddata-stodata-batch,data-call,data-receive, anddata-send, respectively. I originally use the shorter names to reduce the text length. The increased clarity of the longer names is worth the few extra characters. -
Remove expanded error messages. They were nice, but added a bunch of size without a significant improvement.
-
The other big change is removing the leading
_and$characters from function names. They were originally put in place to create a naming convention that differentiated between functions that were hit withdata-callanddata-send. In practice, that wasn't necessary. -
Removed the
data-batchattribute. While there are some use cases where it might be nice, the extra complexity, mental overhead, and maintance aren't worth it. -
Added Mutation Observer so data-* functionality works on elements that are added after initialization.
-
Added Mutation Observer to watch for removed elements to pull them out of the mix when they get gone.
-
Split the web site page up into individual template for sections. Much nicer to work with.
-
Updated example functions to always use
(el, _event)instead of(el, _)for clarity. -
Removed inert/include/ignore from the top level components then remove them. This was originally a way to tell parent components to ignore specific calls and signals from children. After using it a bit, I don't think the complexity is worth it. Better to just name functions an signals so they don't collide.
-
Isolated default signal travel to only go down the DOM. That is, if there are nested bitty-js tags, signals from the child tags don't propagate to the parent by default. (see
data-watchfor how to send signals up and to siblings) -
Added
data-watchso parents and siblings can receive signals from their children and other siblings. With this, signals can be sent up, down, and to siblings. -
Ignore events directly from
bitty-jselements (i.e. only process events from child elements). This is done to preventdata-sendattributes onbitty-jselements from firing repeatedly when things inside the element send events (e.g. clicks). -
Renamed
scriptsdirectory tomodules. -
Moved bitty source script file under
bitty-versions/bitty-v0.3.0.jsand copying to prod at the root of the site (i.e./bitty-v0.3.0.js) so examples look cleaner. -
Renamed
data-bridgetodata-connectfor clarity. -
Renamed
this.widget.bridgetothis.module.apiinbitty-js -
Added
this.api.send(key, event)to send/forward events from inside modules. -
Added Progressive Enhancement and JavaScript Data comparison examples.
-
Added/polished a bunch of other examples.
v0.2.3.md
Version: 0.2.3
June 5, 2025
Lots of error handling work in this one.
-
Moved UUID generation for the
bitty-jsand alldata-*reactive elements to the first thing inconnectedCallback()to aid in error messaging. -
Made
connectedCallback()andasyncfunction to throw loading the widget module into its own funcitoun -
Created an
#errorsprivate var to store error messages and help by ID. - Added the first few error messages
-
Added
this.error()for outputting errors. It takes two optional arguments: an ID and an Element. The ID maps to the IDs in#errors. They're used to add detail and help message to the error output.The ID defaults to
0which is an unclassified error type. The message for that ID includes a note to the developer to use an ID to classify the error. I consider it a bug if an appropriate ID doesn't exist and request an issue be open to fix it.The
this.error()method dumps thebitty-jselemnet after the message.If an element was passed to
this.error()it's dumped out as well.The error message end up being pretty long. The end up adding a bunch of lines to the source file. That's an explicit decision aimed at making bitty easier to work with.
-
Added top level
debugfunction that uses adebugsearch query param from thewindow.locationto see if it should output.Only thing I don't like about it is that it shows the function's line number instead of the line number from where it was called. Something to look into.
-
The
debugfunction takes an optional element. It dumps it to the console if one comes in. -
Renamed
data-wirestodata-bridge. Fits better and maps nicer to the.bridgecoming back in from the support class. - Set up to load the default class exported from a widget module if no other class is defined (which happens with 'data-widget')
- Moved all examples to use a default class export instead of a named class
-
Added a
data-widgetattribute to thebitty-jselements to allow using multiple classes from inside a single supporting .js module file. -
bitty-component-errorandbitty-element-errorclasses are added to the class list of elements where errors occur.
v0.2.2.md
Version: 0.2.2
June 4, 2025
Added UUIDs for pending error handling. Shuffeld a bunch of stuff around to make the examples look nicer.
-
Added uuids as
data-uuidattrs to all elements with relateddata-*attributes. Added them to thebitty-jselements too. I was originally thinking I'd add the UUIDs on the elements internally (i.e.el.uuidinstead ofel.dataset.uuid).I decided on the attribute approach because it offers two benefits: 1. You can see the IDs in the Element tree view of developer consoles, and 2. You can address them with CSS to update styles based on the UUID. Both of those thing will go to supporting better error messages and bug hunting.
- Mostly content updates largely focused on detailing the opening counter example.
- Added CONTRIBUTING file.
- Added watcher script to build site when files change.
-
Refined the initial counter example to remove the text and change the
private variable to
this.numto make the examples look nicer. - Moved the Examples section directly below the initial basic functionality overview section.
- Added reminders all over the place to edit the template and instead of the output for HTML page (which would be overwritten. ask me how I know).
-
Started adding
prettier-ignorecomments to code snippets to prevent the display output from being mangled. -
Started stripping
prettier-ignorecomments from the HTML output so it doesn't show in the example - Same goes for
// deno-fmt-ignore-filein .js files - Added script to maintain the open open/closed states of the section details elements across page loads. (Having them close every time I made a change was maddening)
-
Moved all the example
.jsfiles into the site root. Not a fan of that in general, but it makes the examples look better since the path is shorter.
v0.2.1.md
Version: 0.2.1
June 3, 2025
Some more wiring and some support tools for making the demo/docs site.
- Made a Hello, World example that shows basic features. (Compared to the single button press from the prior first example.)
- Showing Hello, World code as part of the example.
- Load templates automatically.
- Throttling via
.requestAnimationFrame(). -
Renamed
data-ftodata-c(i.e. "call") for clarity. -
Renamed
data-prepattribute onbitty-jstag todata-call(i.e. "call") for clarity. -
Renamed
data-initattribute onbitty-jstag todata-sendso it matchesdata-smore closely. - Made basic site builder for landing page.
-
Moved everything into
detailselements for the landing page.
v0.2.0.md
Version: 0.2.0
June 3, 2025
Setting up a bunch of the basic wiring.
-
Rewrite to provide direct access to receiving elements. They are fully
accessible in the send/receive functions. (As compared to the 0.1.0
approach which required explicitly defining what would happen via an
update (e.g. update
.innerHTMLor.value). -
Renamed
data-wrapperand the targetWrapperclass todata-wiresandWires. (bitty.jsis the wrapper. TheWiresclass is how things are hooked up.). -
Added
data-callattribute parsing tobitty-jstag. It runs functions likedata-cbut does so prior to adding the event listeners to the element. -
Added
data-batchattribute processing tobitty-jstags. It operates likedata-bbut fires before event listeners are added. -
Added
data-ignoreattribute to allow components to avoid calls to the named functions. (Send signals bubble up to parents of nested components by default. This provides a way to ignore them). -
The
bitty-jselement looks for an.init()method in theWiresclass. If it finds one it calls it during the initialization process. - Passing both the element and the triggering event to the send/receive functions.
-
Moved to using
data-bexplicitly to separate block calls from individual function calls. - Order of operations is: function calls, batch calls, single send calls.
- Temporarily removed preflight check until global functionality is defined.
-
Created example of loading a template via the
.init()call back to theWiresclass. - Created example with nested components.
- Created example with parent of child components pulling data from the children to do a calculation.
- Created example showing parent ignoring send signals from children.
- Created example showing on components loading a child component via a template that becomes fully reactive.
v0.1.0.md
Version: 0.1.0
June 2, 2025
Getting the project started.
-
Initial prototype.
-
<bitty-js>;wraps elements to provide them with reactive capabilities. -
Basic
data-c,data-s, anddata-rin place to call functions, send, and receive updates, respectively. -
Functionality is loaded using
data-wrapperto point to a module to load. The module must export aWrapperclass that gets loaded and used to provide functions and send/receive callbacks. -
Uses string prefixes to make determinations about how to handle data through the send/receive channels (e.g.
htmlSOMETHINGupdates.innerHTMLof an element whilevalueSOMETHINGupdates the.value). -
Defined convention for functions.
data-cmaps to functions in theWrapperclass that start with a_(underscore). Thedata-sanddata-rattributes map to functions in theWrapperclass that start with a$(dollar sign). -
Decided against using
data-c data-s and data-ron thebitty.jstags. That would involved a lot of extra overhead in parsing to differentiate between the top level element and the content it wraps. Usingdata-sendinstead as a replacement fordata-c. Others, TBD. -
Set up
data-c="batchSOMETHIGN"functionality to send a single single that gets turned into multiple signals in theWrapper. -
Defined convention of using
.batchesto look for batches. It must be a hash where the keys match the incoming request and the value is an array of functions to run. -
Defined
.bridgeto allowWrapperfunctions to access the parentbitty-jselement. -
Scoped event listeners to the
bitty-jselements. -
Set up
data-listenersattribute onbitty-jstags to override the default listeners (which areinputandclick). -
Created example that stores its own state.
-
Created example that updates an element with the same content it sent (i.e. verified feedback can be avoided).
-
Created example using
data-sendto load initial values. -
Created example that sends multiple signals.
-
Created example with multiple elements receiving the same signal.
-
Created example showing how to update global CSS variables/properties.
-
Created example showing custom event listeners.
-
Created example showing how to update CSS variables/properties scoped to the content of individual
bitty-jstags. -
Examples use parent page's CSS for styling. It confirms I'm happy with the choice to use the light DOM instead of the shadow DOM.
-
Set up initial preflight check to ensure functions are in place.