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

Commit

Permalink
2.1.3 - Periods are now allowed in the RHS of ForNode expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
insin committed May 31, 2012
1 parent 0856c24 commit 7e3df65
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/DOMBuilder.dom.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* DOMBuilder 2.1.2 (modes: dom [default]) - https://github.com/insin/DOMBuilder
* DOMBuilder 2.1.3 (modes: dom [default]) - https://github.com/insin/DOMBuilder
* MIT Licensed
*/
;(function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/DOMBuilder.dom.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/DOMBuilder.html.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* DOMBuilder 2.1.2 (modes: html [default]) - https://github.com/insin/DOMBuilder
* DOMBuilder 2.1.3 (modes: html [default]) - https://github.com/insin/DOMBuilder
* MIT Licensed
*/
;(function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/DOMBuilder.html.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/DOMBuilder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* DOMBuilder 2.1.2 (modes: dom [default], html) - https://github.com/insin/DOMBuilder
* DOMBuilder 2.1.3 (modes: dom [default], html) - https://github.com/insin/DOMBuilder
* MIT Licensed
*/
;(function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/DOMBuilder.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/DOMBuilder.template.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* DOMBuilder 2.1.2 (modes: dom [default], html, template) - https://github.com/insin/DOMBuilder
* DOMBuilder 2.1.3 (modes: dom [default], html, template) - https://github.com/insin/DOMBuilder
* MIT Licensed
*/
;(function() {
Expand Down Expand Up @@ -1584,7 +1584,7 @@ var slice = Array.prototype.slice
/** Separator used for object lookups. */
var VAR_LOOKUP_SEPARATOR = '.'
/** RegExp for specifying the loop variable for a ForNode. */
var FOR_RE = /( in )([\w_]+)$/
var FOR_RE = /( in )([\.\w_]+)$/
/** Separator for specifying multiple variable names to be unpacked. */
var UNPACK_SEPARATOR_RE = /, ?/
/** RegExp for template variables. */
Expand Down
4 changes: 2 additions & 2 deletions dist/DOMBuilder.template.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
News for DOMBuilder
===================

2.1.3 / 2012-05-31
------------------

* Periods are now allowed on the RHS of ForNode expressions, so it's possible to
look up items to be iterated over from another template context variable.

2.1.2 / 2012-05-29
------------------

Expand Down
2 changes: 1 addition & 1 deletion lib/dombuilder/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var slice = Array.prototype.slice
/** Separator used for object lookups. */
var VAR_LOOKUP_SEPARATOR = '.'
/** RegExp for specifying the loop variable for a ForNode. */
var FOR_RE = /( in )([\w_]+)$/
var FOR_RE = /( in )([\.\w_]+)$/
/** Separator for specifying multiple variable names to be unpacked. */
var UNPACK_SEPARATOR_RE = /, ?/
/** RegExp for template variables. */
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "DOMBuilder"
, "description": "Builder library - generate HTML with an API which is also usable in the browser"
, "version": "2.1.2"
, "version": "2.1.3"
, "author": "Jonathan Buchanan <jonathan.buchanan@gmail.com> (https://github.com/insin)"
, "tags": ["dualsided", "DOM", "HTML", "builder", "templates"]
, "main": "./lib/dombuilder"
Expand Down
8 changes: 7 additions & 1 deletion tests/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ QUnit.test('ForNode', function() {
deepEqual(items, [], 'Zero items - item context as expected');
deepEqual(forloops, [], 'Zero items - forloop context as expected');

// SIngle item
// Single item
items = f.render(templates.Context({'items': [1]}));
deepEqual(items, [1], 'Single item - item context as expected');
deepEqual(forloops, [{
Expand Down Expand Up @@ -414,6 +414,12 @@ QUnit.test('ForNode', function() {
// 'in' is a valid loop variable name
templates.$for('person, in in things');
ok(true, 'Valid: "person, in in things"');

// Should be able to look up items from other context variables
f = templates.$for('item in items.things', '{{ item }}');
deepEqual(f.render(templates.Context({items: {things: [1,2,3]}})),
[[1], [2], [3]],
'Valid: "item in items.things"');
});

QUnit.test('IfNode', function() {
Expand Down

0 comments on commit 7e3df65

Please sign in to comment.