Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Use incremental-dom #7

Closed
wants to merge 44 commits into from
Closed

Use incremental-dom #7

wants to merge 44 commits into from

Conversation

shawnbot
Copy link
Owner

This complete rewrite uses Google's incremental-dom and employs a fundamentally different model than the original API. Here are some highlights:

  • The entire DOM tree of the template element is encoded as a patching function that uses incremental-dom to "play back" its structure, given variable data and directives. This encoding happens only once, after which any changes to the template element should have no effect, with the possible exception of directive functions that read from the DOM via this.
  • Data bindings and directives are evaluated on a per-element basis, and can apply to multiple elements in the tree.
  • Fixes Binding to directives that return arrays prevents sub-directives #6 with "nested" directive keys, so you can bind to a dynamic array and set attributes of the iterative elements.
  • Explicit support for data-bind and data-each attributes, though the usage differs now.
  • Tests run with Karma in PhantomJS, woohoo!

TODO:

  • Make test/spec.js more readable with HTML strings, instead of DOM calls.
  • Figure out the issue with binding scalars to the template node directly, or throw an error in this case, since it's not very obvious.
  • Resolve weird data-bind vs. data-each differences by writing better tests for array binding with data-bind (which should just repeat the element's children).

@shawnbot shawnbot self-assigned this Jul 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant