This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 29 September 2023 | |
// What's in an array? | |
// Here's an array: | |
var a = [1,2,3,4]; | |
// If we use want only the *own* properties of an array, we can use the | |
// Object.keys() method to inspect it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 21 September 2023 | |
// Collect a node's Comment, Text, and Attribute child nodes | |
// should break this up into separate functions focused on node type | |
// then find items by their nodeValue | |
function collect(node) { | |
var comments = []; | |
var text = []; | |
var attributes = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 27 September 2023 | |
// onpropertychange signal v.9 | |
// cf. v.8 https://gist.github.com/dfkaye/548622151971122110bf4047ae3ac432 | |
// and v.1 https://gist.github.com/dfkaye/619c5f31080fce2cd383ac966e132311 | |
// Success, at last! v.9 supports both Object and EventTarget. | |
// Investigating where proxy on an array allows array.push mutations, the goal | |
// here was to get the proxy to work on EventTarget and Object, this time with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 26 September 2023 | |
// onpropertychange signal v.8 | |
// cont'd from https://gist.github.com/dfkaye/3affad4c43e363a84ac4320eae375129 | |
// Going back to v.1 prototype enhancement/pollution, (see | |
// https://gist.github.com/dfkaye/619c5f31080fce2cd383ac966e132311), trying to | |
// simplify the prototype stack. | |
// The signals and delegate properties are assigned on the target using the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 22 September 2023 | |
// onpropertychange signal v.7 | |
// cont'd from https://gist.github.com/dfkaye/1d9a55b8fe6659df7ba7c04edbd24bf7 | |
// Another one that seems to work (we get events from Array changes) but my | |
// reasoning in the comments seems hand-wavingly suspect. | |
// Method delegation adds more setup time (iterating and so on), another mapping | |
// dependency, and copying the prototype and setting that as the new prototype |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 21 September 2023 | |
// onpropertychange signal v.6 already | |
// cont'd from https://gist.github.com/dfkaye/dae6958adf813735d9154be23a0ebb09 | |
// Still not happy but we have better support across types of objects (only | |
// element, text, object, and array so far). | |
// After all that, Object.defineProperty on property names is enough to ensure | |
// related property updates, e.g., {textContent, nodeValue, data, wholeText}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 20 September 2023 | |
// onpropertychange signal v.5 | |
// cont'd from https://gist.github.com/dfkaye/428abdeca224c37014d27fc420906d88 | |
// propertychange events on a node with a mixture of property descriptors and | |
// proxy handlers | |
// come back to this for the onpropertychange part | |
// SEE sketch 17 September 2023, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 18 september 2023 | |
// onpropertychange signal v.4 | |
// cont'd from https://gist.github.com/dfkaye/4e06eb749f878662e31a6cb019fbd650 | |
// re-done in less than 30 minutes, this implementation makes more sense and | |
// works for arrays and objects... | |
// 19 September 2023 | |
// dispatch propertychange event in deleteProperty handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 17 September 2023 | |
// onpropertychange signal v.3 | |
// onpropertychange sketch for form element nodes | |
// cont'd from https://gist.github.com/dfkaye/d849596bdb9e926ad69ad38c974a4763 | |
function N(node) { | |
var target = node; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 16 september 2023 | |
// onpropertychange signal v.2 | |
// An implementation with proxied objects. | |
// cont'd from https://gist.github.com/dfkaye/619c5f31080fce2cd383ac966e132311 | |
//////////////////////////////////////////////////////////////////////////////// | |
// early afternoon |