Skip to content

Commit

Permalink
Commit 73 (v0.9.73 - Beta)
Browse files Browse the repository at this point in the history
Minor update: no important changes or bug fixes

- Updated copyright and updated links to latest jQuery, QUnit etc.

- Some documentation improvements
  New documentation topic on JsViews view object, and methods:
  http://www.jsviews.com/#jsvviewobject
  - view.refresh()
  - view.contents()
  - view.nodes()
  - view.childTags()
  • Loading branch information
BorisMoore committed Feb 16, 2016
1 parent 0072edc commit 2e00b5a
Show file tree
Hide file tree
Showing 28 changed files with 239 additions and 151 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

The content of this ***ReadMe*** is available also as a *[JsViews Quickstart](http://www.jsviews.com/#jsv-quickstart)*.

<h3>Installation</h3>
<h2>JsViews Installation</h2>

jsviews.js is available from [downloads](http://www.jsviews.com/#download) on the jsviews.com site.

Expand All @@ -19,6 +19,8 @@ Alternatively:
- It can be loaded using an AMD script loader, such as RequireJS
- For installation using *Node.js* (*npm*) -- and browser loading using *Browserify* -- see *[JsRender Node.js Quickstart](http://www.jsviews.com/#jsr-node-quickstart)*

*Example HTML page:* [Loading JsViews](http://www.jsviews.com/#download/pages-jsv)

<h3>JsRender and JsViews</h3>
**JsRender** is used for data-driven rendering of templates to strings, ready for insertion in the DOM. (See *[JsRender Quickstart](http://www.jsviews.com/#jsr-quickstart)* and [JsRender GitHub repository](https://github.com/BorisMoore/jsrender)).

Expand Down Expand Up @@ -240,7 +242,6 @@ $(".changeBtn").on("click", function() {

[Learn more...](http://www.jsviews.com/#$view)


<h3><i>Data-linked paths</i></h3>

JsViews data-linked templates (and the `$.observe()` API) use the same [paths and expressions](http://www.jsviews.com/#paths) as JsRender templates, but in addition provide *'leaf'* data-binding -- such as:
Expand Down
6 changes: 3 additions & 3 deletions jquery.observable.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*! JsObservable v0.9.72 (Beta): http://jsviews.com/#jsobservable */
/*! JsObservable v0.9.73 (Beta): http://jsviews.com/#jsobservable */
/*
* Subcomponent of JsViews
* Data change events for data-linking
*
* Copyright 2015, Boris Moore
* Copyright 2016, Boris Moore
* Released under the MIT License.
*/

Expand Down Expand Up @@ -44,7 +44,7 @@ if (!$ || !$.fn) {
throw "JsObservable requires jQuery"; // We require jQuery
}

var versionNumber = "v0.9.72",
var versionNumber = "v0.9.73",
$observe, $observable,

$views = $.views =
Expand Down
4 changes: 2 additions & 2 deletions jquery.observable.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jquery.observable.min.js.map

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions jquery.views.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jquery.views.js v0.9.72 (Beta): http://jsviews.com/ */
/*! jquery.views.js v0.9.73 (Beta): http://jsviews.com/ */
/*
* Interactive data-driven views using JsRender templates.
* Subcomponent of JsViews
Expand All @@ -7,7 +7,7 @@
* Also requires jquery.observable.js
* See JsObservable at http://jsviews.com/#download and http://github.com/BorisMoore/jsviews
*
* Copyright 2015, Boris Moore
* Copyright 2016, Boris Moore
* Released under the MIT License.
*/

Expand Down Expand Up @@ -44,7 +44,7 @@ var global = (0, eval)('this'), // jshint ignore:line
jsr = jsr || setGlobals && global.jsrender;
$ = $ || global.jQuery;

var versionNumber = "v0.9.72",
var versionNumber = "v0.9.73",
requiresStr = "JsViews requires ";

if (!$ || !$.fn) {
Expand Down Expand Up @@ -2267,7 +2267,7 @@ function addLinkMethods(tagOrView, isTag) {
tagOrView.contents = function(deep, select) {
// For a view or a tag, return jQuery object with the content nodes,
if (deep !== !!deep) {
// deep not boolean, so this is getContents(selector)
// deep not boolean, so this is contents(selector)
select = deep;
deep = undefined;
}
Expand Down Expand Up @@ -2374,6 +2374,7 @@ function addLinkMethods(tagOrView, isTag) {
};

if (isTag) {
// This is a TAG
tagOrView.domChange = function() { // domChange notification support
var elem = this.parentElem,
hasListener = $.hasData(elem) && $._data(elem).events,
Expand All @@ -2385,7 +2386,8 @@ function addLinkMethods(tagOrView, isTag) {
}
};
} else {
// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...
// This is a VIEW
// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...
tagOrView.addViews = function(index, dataItems, tmpl) {
// if view is not an array view, do nothing
var i, viewsCount,
Expand Down Expand Up @@ -2511,12 +2513,12 @@ function addLinkMethods(tagOrView, isTag) {
return this;
};

tagOrView.refresh = function(context) {
tagOrView.refresh = function() {
var self = this,
parent = self.parent;

if (parent) {
renderAndLink(self, self.index, self.tmpl, parent.views, self.data, context, true);
renderAndLink(self, self.index, self.tmpl, parent.views, self.data, undefined, true);
setArrayChangeLink(self);
}
return self;
Expand Down
4 changes: 2 additions & 2 deletions jquery.views.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jquery.views.min.js.map

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions jsrender.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*! JsRender v0.9.72 (Beta): http://jsviews.com/#jsrender */
/*! JsRender v0.9.73 (Beta): http://jsviews.com/#jsrender */
/*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */
/*
* Best-of-breed templating in browser or on Node.js.
* Does not require jQuery, or HTML DOM
* Integrates with JsViews (http://jsviews.com/#jsviews)
*
* Copyright 2015, Boris Moore
* Copyright 2016, Boris Moore
* Released under the MIT License.
*/

Expand All @@ -32,7 +32,7 @@
}
} (

// factory (for jquery.views.js)
// factory (for jsrender.js)
function($) {
"use strict";

Expand All @@ -44,7 +44,7 @@ var global = (0, eval)('this'), // jshint ignore:line

$ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery.

var versionNumber = "v0.9.72",
var versionNumber = "v0.9.73",
jsvStoreName, rTag, rTmplString, topView, $views,

//TODO tmplFnsCache = {},
Expand Down Expand Up @@ -235,10 +235,10 @@ function $viewsDelimiters(openChars, closeChars, link) {
// make rTag available to JsViews (or other components) for parsing binding expressions
$sub.rTag = "(?:" + rTag + ")";
// { ^? { tag+params slash? or closingTag or comment
rTag = new RegExp("(?:" + openChars + rTag + "(\\/)?|\\" + delimOpenChar0 + "\\" + delimOpenChar1 + "(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))" + closeChars, "g");
rTag = new RegExp("(?:" + openChars + rTag + "(\\/)?|\\" + delimOpenChar0 + "(\\" + linkChar + ")?\\" + delimOpenChar1 + "(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))" + closeChars, "g");

// Default: bind tagName cvt cln html code params slash closeBlk comment
// /(?:{(\^)?{(?:(\w+(?=[/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{{(?:(?:\/(\w+))|!--[\s\S]*?--))}}/g
// Default: bind tagName cvt cln html code params slash bind2 closeBlk comment
// /(?:{(\^)?{(?:(\w+(?=[\/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{(\^)?{(?:(?:\/(\w+))\s*|!--[\s\S]*?--))}}

rTmplString = new RegExp("<.*>|([^\\\\]|^)[{}]|" + openChars + ".*" + closeChars);
// rTmplString looks for html tags or { or } char not preceded by \\, or JsRender tags {{xxx}}. Each of these strings are considered
Expand Down Expand Up @@ -1224,43 +1224,43 @@ function tmplFn(markup, tmpl, isLinkExpr, convertBack, hasElse) {
}
}

function parseTag(all, bind, tagName, converter, colon, html, codeTag, params, slash, closeBlock, index) {
function parseTag(all, bind, tagName, converter, colon, html, codeTag, params, slash, bind2, closeBlock, index) {
/*
bind tagName cvt cln html code params slash closeBlk comment
/(?:{(\^)?{(?:(\w+(?=[/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{{(?:(?:\/(\w+))|!--[\s\S]*?--))}}/g
bind tagName cvt cln html code params slash bind2 closeBlk comment
/(?:{(\^)?{(?:(\w+(?=[\/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{(\^)?{(?:(?:\/(\w+))\s*|!--[\s\S]*?--))}}/g
(?:
{(\^)?{ bind
{(\^)?{ bind
(?:
(\w+ tagName
(\w+ tagName
(?=[\/\s}])
)
|
(\w+)?(:) converter colon
(\w+)?(:) converter colon
|
(>) html
(>) html
|
(\*) codeTag
(\*) codeTag
)
\s*
( params
( params
(?:[^}]|}(?!}))*?
)
(\/)? slash
(\/)? slash
|
{{
{(\^)?{ bind2
(?:
(?:\/(\w+)) closeBlock
(?:\/(\w+))\s* closeBlock
|
!--[\s\S]*?-- comment
!--[\s\S]*?-- comment
)
)
}}/g
*/

if (codeTag && bind || slash && !tagName || params && params.slice(-1) === ":") {
if (codeTag && bind || slash && !tagName || params && params.slice(-1) === ":" || bind2) {
syntaxError(all);
}

Expand Down
4 changes: 2 additions & 2 deletions jsrender.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jsrender.min.js.map

Large diffs are not rendered by default.

53 changes: 27 additions & 26 deletions jsviews.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*! jsviews.js v0.9.72 (Beta) single-file version: http://jsviews.com/ */
/*! jsviews.js v0.9.73 (Beta) single-file version: http://jsviews.com/ */
/*! includes JsRender, JsObservable and JsViews - see: http://jsviews.com/#download */

/* Interactive data-driven views using JsRender templates */

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsRender >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/* JsRender:
* See http://jsviews.com/#jsrender and http://github.com/BorisMoore/jsrender
* Copyright 2015, Boris Moore
* Copyright 2016, Boris Moore
* Released under the MIT License.
*/

Expand Down Expand Up @@ -47,7 +47,7 @@ if (!$ || !$.fn) {
throw "JsViews requires jQuery"; // We require jQuery
}

var versionNumber = "v0.9.72",
var versionNumber = "v0.9.73",

jsvStoreName, rTag, rTmplString, topView, $views, $observe, $observable,

Expand Down Expand Up @@ -239,10 +239,10 @@ function $viewsDelimiters(openChars, closeChars, link) {
// make rTag available to JsViews (or other components) for parsing binding expressions
$sub.rTag = "(?:" + rTag + ")";
// { ^? { tag+params slash? or closingTag or comment
rTag = new RegExp("(?:" + openChars + rTag + "(\\/)?|\\" + delimOpenChar0 + "\\" + delimOpenChar1 + "(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))" + closeChars, "g");
rTag = new RegExp("(?:" + openChars + rTag + "(\\/)?|\\" + delimOpenChar0 + "(\\" + linkChar + ")?\\" + delimOpenChar1 + "(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))" + closeChars, "g");

// Default: bind tagName cvt cln html code params slash closeBlk comment
// /(?:{(\^)?{(?:(\w+(?=[/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{{(?:(?:\/(\w+))|!--[\s\S]*?--))}}/g
// Default: bind tagName cvt cln html code params slash bind2 closeBlk comment
// /(?:{(\^)?{(?:(\w+(?=[\/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{(\^)?{(?:(?:\/(\w+))\s*|!--[\s\S]*?--))}}

rTmplString = new RegExp("<.*>|([^\\\\]|^)[{}]|" + openChars + ".*" + closeChars);
// rTmplString looks for html tags or { or } char not preceded by \\, or JsRender tags {{xxx}}. Each of these strings are considered
Expand Down Expand Up @@ -1228,43 +1228,43 @@ function tmplFn(markup, tmpl, isLinkExpr, convertBack, hasElse) {
}
}

function parseTag(all, bind, tagName, converter, colon, html, codeTag, params, slash, closeBlock, index) {
function parseTag(all, bind, tagName, converter, colon, html, codeTag, params, slash, bind2, closeBlock, index) {
/*
bind tagName cvt cln html code params slash closeBlk comment
/(?:{(\^)?{(?:(\w+(?=[/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{{(?:(?:\/(\w+))|!--[\s\S]*?--))}}/g
bind tagName cvt cln html code params slash bind2 closeBlk comment
/(?:{(\^)?{(?:(\w+(?=[\/\s}]))|(\w+)?(:)|(>)|(\*))\s*((?:[^}]|}(?!}))*?)(\/)?|{(\^)?{(?:(?:\/(\w+))\s*|!--[\s\S]*?--))}}/g
(?:
{(\^)?{ bind
{(\^)?{ bind
(?:
(\w+ tagName
(\w+ tagName
(?=[\/\s}])
)
|
(\w+)?(:) converter colon
(\w+)?(:) converter colon
|
(>) html
(>) html
|
(\*) codeTag
(\*) codeTag
)
\s*
( params
( params
(?:[^}]|}(?!}))*?
)
(\/)? slash
(\/)? slash
|
{{
{(\^)?{ bind2
(?:
(?:\/(\w+)) closeBlock
(?:\/(\w+))\s* closeBlock
|
!--[\s\S]*?-- comment
!--[\s\S]*?-- comment
)
)
}}/g
*/

if (codeTag && bind || slash && !tagName || params && params.slice(-1) === ":") {
if (codeTag && bind || slash && !tagName || params && params.slice(-1) === ":" || bind2) {
syntaxError(all);
}

Expand Down Expand Up @@ -2034,7 +2034,7 @@ if (jsrToJq) { // Moving from jsrender namespace to jQuery namepace - copy over
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsObservable >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/* JsObservable:
* See http://www.jsviews.com/#jsobservable and http://github.com/borismoore/jsviews
* Copyright 2015, Boris Moore
* Copyright 2016, Boris Moore
* Released under the MIT License.
*/

Expand Down Expand Up @@ -3004,7 +3004,7 @@ if (!$.observe) {
/* JsViews:
* Interactive data-driven views using templates and data-linking.
* See http://www.jsviews.com/#jsviews and http://github.com/BorisMoore/jsviews
* Copyright 2015, Boris Moore
* Copyright 2016, Boris Moore
* Released under the MIT License.
*/

Expand Down Expand Up @@ -5200,7 +5200,7 @@ function addLinkMethods(tagOrView, isTag) {
tagOrView.contents = function(deep, select) {
// For a view or a tag, return jQuery object with the content nodes,
if (deep !== !!deep) {
// deep not boolean, so this is getContents(selector)
// deep not boolean, so this is contents(selector)
select = deep;
deep = undefined;
}
Expand Down Expand Up @@ -5318,7 +5318,8 @@ function addLinkMethods(tagOrView, isTag) {
}
};
} else {
// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...
// This is a view
// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...
tagOrView.addViews = function(index, dataItems, tmpl) {
// if view is not an array view, do nothing
var i, viewsCount,
Expand Down Expand Up @@ -5444,12 +5445,12 @@ function addLinkMethods(tagOrView, isTag) {
return this;
};

tagOrView.refresh = function(context) {
tagOrView.refresh = function() {
var self = this,
parent = self.parent;

if (parent) {
renderAndLink(self, self.index, self.tmpl, parent.views, self.data, context, true);
renderAndLink(self, self.index, self.tmpl, parent.views, self.data, undefined, true);
setArrayChangeLink(self);
}
return self;
Expand Down
7 changes: 4 additions & 3 deletions jsviews.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jsviews.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsviews",
"version": "v0.9.72",
"version": "v0.9.73",
"description": "Next-generation MVVM and MVP framework - built on top of JsRender templates. Bringing templates to life...",
"main": "./jsviews.js",
"author": {
Expand Down Expand Up @@ -33,7 +33,7 @@
"glob-stream": "^5.0.0",
"gulp": "^3.9.0",
"jquery": "^2.1.4",
"jsrender": "^0.9.72",
"jsrender": "^0.9.73",
"qunit": "^0.7.6"
},
"dependencies": {}
Expand Down
Loading

0 comments on commit 2e00b5a

Please sign in to comment.