Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

133 lines (120 sloc) 9.13 kb
--- upcomming goals ---
- bug: treat lookup failures on dot access and within directives as if they were if blocks (by turning them off)? Case: if you negate a failed lookup, do you want it to be truthy?
- don't recurse into anchored nodes
- anchor command also updates
- phase out 'for' directive
- add each directive, which doesn't get an index
- deprecate the .update() function
- rename to bound
- allow in-js syntax for data binding
- make contain work with jquery objects
- jquery syntax for finding subnodes
- fix it so it filters out bound children
- jquery syntax for finding anchored children
--- quick refactors ---
- get rid of _conditionalShow(), rely on classes
- automatically lookup the tokens provided to a command. offer the option of defining a resolve() function when users want to do the lookup work manually
--- improvements to existing ---
- mutation of loop nodes should be persistent
- deleting a node means no update happens
- re-ordering nodes in a loop remains the same
- add a class to every generated node for easy lookup/modification in the tree
- make sure iteration works over jquery objects and other array-likes
--- new features ---
- allow delayed updates that wait until a flag is turned on (add a readiness flag for objects)
- monitoring support for run operations
- how many nodes were visted
- how many directives were processed
- if directives were ever re-visted
- 'class' and 'classes' directive
- binding syntax and dynamic partial inclusion, to allow code sharing in templates
- allow a containEach directive?
- jquery selection syntax for finding child directives that reference properties available in the current directive's scope
--- new major features ---
- move to closure based data storage for each object
- move to .commit() for updating observers
- converter for a simpler abstraction language that generates react nodes (sort of like handlebars)
- an in-javascript syntax for defining bound relationships of objects and nodes
--- safeguards ---
- whenever a directive might insert a node, verify that the node has not been rendered for a different context already during this update
- harden all operations after run() has completed
- harden getParent() operations after first call, and ensure complete correctness of all parent data after the first time
- in pre-lookups, restrict all keys to valid alphanumerics
--- open questions ---
- what if a listened-to property is stored somewhere up the prototype chain? how can listeners be registered there?
--- bugs ---
- progressive rendering: type check in iteration, and only allow arrays (especially not strings)
- in createItemNodes, don't allow looping over static native objects (like strings - this is almost certainly an error)
- when the check for "key in object" for lookup() happens, it errors on non-object primitives like strings
- attrIf needs the same persistence behavior as classIf, write test for it first
- check if this issue exists: after an if directive evaluates to false, setting it to true and activating the listener should update subtree
- should ignore binding scopes when looking for scope to iterate over
--- optimizations ---
- remove all memoizers, and set all parent state once only
- *disassociate listeners when node gets updated against new object
- clean up any pre-existing observers (lookup time? observation time?)
- store observers in on a per-anchoring basis, for easy cleanup of memory references
- make all observers write to a single string in some serialization format
- possible: when selecting react nodes to visit, generate a :not() selector that excludes children of other react nodes. works in all but IE<=8 (http://www.quirksmode.org/css/contents.html), and is no slower there (since we have to visit all nodes anyway). have to check that selection behavior is same as jquery though, and doesn't consider parents of the selection context.
- for compressability, rework error messages to be shorter and described more fully in comments
- make directive.consider() add to a keyed hash of reasons, rather than a list, and check 'force' first
--- refactors ---
- fix this: in createItemNodes, we simply put an observer on the length property that results in a complete re-render of the looping directive if ever a change in length is noticed
- remove .anchorKey from scope chains
- don't think we need matchingBaseObject in the return details of a lookup, maybe just check if it's contained in the scope chain
- prefix probably doesn't need to be stored in scopeChain, it can be passed via potentialObservers. this would allow .observe() to be taken off the scopeChain object
- deprecate options from makeScopeChain
- moving away from jquery dependency
- change $.find() back to queryselectorall $.find() (note calling Array.prototype.slice.call on the results of a call to .querySelectorAll blows up in IE)
- see if there's a more efficient way to build an array other than iterating over the array like object
--- cleanup ---
remove ._scopeInjectionArgLists property of directives
--- tests ---
- performance tests
- test iteration count to ensure this behavior is working: earmark any nodes that have been found in a querySelectorAll call, so we don't have to add their children again when they show up in the 'branchesToConsider' list
- negation doesnt break for dot access
- classIf is not cumulative. the second time a class is added, the old one will not be cleaned up
- test that when a directive has already had all subtrees queued for visiting, visitBranch() passes for repeat calls
- without using .data(), IE copies expando properties over, breaking loop behaviors and other cloning operations. write a test for the failing behavior and implement replacement to .data()
- test that integrate.jQuery.items() works, as well as .itemTemplate(). also, error when called on non-looping nodes
- second descendants of a deadDescendants branch and a dirtyDescendants branch should inherit the state
- when a directive is marked for consideration, then removed from the tree by a contain or withinEach directive, the node still works if another directive swapps it in. probably doesnt matter since substituted nodes don't get recursed onto
- empty react attribute string doesnt break universe
- attributes should be removed if property is undefined, even after deletion
- when a within command fails lookup, the new scope is not added to the chain
- cannot pass jquery objects to react.update() that have more than 1 element
- test that every directive can be run on an undefined object
- 'anchored', 'within', 'withinItem', and 'bindItem' all need their subtrees rerendered on change
- nodes within a contain directive don't inherit a scope chain
- ideally, lookups dont fall through above a contain or anchored directive
- updates to properties that had been listened to with bindItem might not recalculate (since they're listening to the wrong scope object). maybe this just applies when the name being bound to changes
- within can be run on undefined objects (should this turn the branch off like 'if', or just not add the scope to the chain?)
- can anchor one node to multiple scopes
- verify that responses to change events don't result in new observers
- can use dot access on bound items
- updates to items in a list (associated with the key or value of a bindItem) change appropriately. consider listener.check(), which might not have updated unless the fallthrough registration just worked
- test support for anchoring to whole scope chains
- test('increasing the length property of a list appends extra nodes', function(){});
- test('reducing the length property of a list deletes extra nodes', function(){});
- test('lookups to loop items don\'t fall through past the top scope if that item holds undefined', function(){});
- test('don\'t allow looping within non-enumerable (or non-observable) objects', function(){});
- test('recomputes all subnodes when changing the value stored at some index of an observed array that was looped over', function(){});
- test('when a list item is removed, associated loop item nodes disappear', function(){
- test('todo: write a test this for inadvertent fallthrough, for the case where lookup of a withinItem key hits undefined and falls through this._lookupInScopeChain(args[0], lastLink)', function(){});
- test('works with a missing key alias', function(){/*...*/});
/* todo
var object = ['a', 'b'];
var node = $('\
<div react="for which item">\
<span class="item" react="contain item"></span>\
<span id="container"></span></div>\
')[0];
react.update({node: node, scope: object, anchor: true});
same($($('#container .item', node)[1]).html(), 'b', 'second item got set');
object.slice(0,1);
react.changed(object, 1);
// before the bug fix, the binding instruction from the outer 'for' directive never got blown away as the scope chain got built up
// thus, there would have been an extra key binding scope, instead of the normal withinEach style scope change into a property
same($('#container .item', node).length, 1, 'redundant node got deleted');
*/
});
Jump to Line
Something went wrong with that request. Please try again.