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

Commit

Permalink
093 final
Browse files Browse the repository at this point in the history
  • Loading branch information
soney committed Jan 16, 2014
1 parent 94ee94d commit 25421c6
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 176 deletions.
318 changes: 159 additions & 159 deletions api/index.html

Large diffs are not rendered by default.

24 changes: 17 additions & 7 deletions build/cjs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ConstraintJS (CJS) 0.9.3-beta
// ConstraintJS (CJS) 0.9.3
// ConstraintJS may be freely distributed under the MIT License
// http://cjs.from.so/

Expand Down Expand Up @@ -38,7 +38,7 @@ var nativeSome = ArrayProto.some,
//Bind a function to a context
var bind = function (func, context) { return function () { return func.apply(context, arguments); }; },
trim = function(str){
return nativeTrim ? nativeTrim.call(str) : String(str).replace(new RegExp(/^\s+|\s+$/, 'g'), '');
return nativeTrim ? nativeTrim.call(str) : String(str).replace(/^\s+|\s+$/g, '');
},
doc = root.document,
sTO = bind(root.setTimeout, root),
Expand All @@ -61,6 +61,16 @@ var bind = function (func, context) { return function () { return func.apply(con
">>>": function (a, b) { return a >>> b;}
};


var getTextContent, setTextContent;
if(doc && !('textContent' in doc.createElement('div'))) {
getTextContent = function(node) { return node.innerText; };
setTextContent = function(node, val) { node.innerText = val; };
} else {
getTextContent = function(node) { return node.textContent; };
setTextContent = function(node, val) { node.textContent = val; };
}

// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};

Expand Down Expand Up @@ -1878,7 +1888,7 @@ extend(cjs, {
* @property {string} cjs.version
* @see cjs.toString
*/
version: "0.9.3-beta", // This template will be filled in by the builder
version: "0.9.3", // This template will be filled in by the builder

/**
* Print out the name and version of ConstraintJS
Expand Down Expand Up @@ -4236,7 +4246,7 @@ var create_list_binding = function(list_binding_getter, list_binding_setter, lis
* cjs.bindText(my_elem, message);
*/
var text_binding = create_textual_binding(function(element, value) { // set the escaped text of a node
element.textContent = value;
setTextContent(element, value);
}),

/**
Expand Down Expand Up @@ -5631,7 +5641,7 @@ var child_is_dynamic_html = function(child) { return child.type === "unary_hb"
},
get_escaped_html = function(c) {
if(c.nodeType === 3) {
return escapeHTML(c.textContent);
return escapeHTML(getTextContent(c));
} else {
return escapeHTML(c.outerHTML);
}
Expand Down Expand Up @@ -6310,9 +6320,9 @@ extend(cjs, {
createTemplate: function(template_str) {
if(!isString(template_str)) {
if(is_jquery_obj(template_str) || isNList(template_str)) {
template_str = template_str.length > 0 ? trim(template_str[0].textContent) : "";
template_str = template_str.length > 0 ? trim(getTextContent(template_str[0])) : "";
} else if(isElement(template_str)) {
template_str = trim(template_str.textContent);
template_str = trim(getTextContent(template_str));
} else {
template_str = "" + template_str;
}
Expand Down
6 changes: 3 additions & 3 deletions build/cjs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/cjs.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "constraintjs",
"version": "0.9.3-beta",
"version": "0.9.3",
"description": "Constraint library for JavaScript",
"author": "Stephen Oney <[email protected]> (http://from.so/)",
"homepage": "http://cjs.from.so/",
Expand Down
2 changes: 1 addition & 1 deletion src/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ var create_list_binding = function(list_binding_getter, list_binding_setter, lis
* cjs.bindText(my_elem, message);
*/
var text_binding = create_textual_binding(function(element, value) { // set the escaped text of a node
element.textContent = value;
setTextContent(element, value);
}),

/**
Expand Down
6 changes: 3 additions & 3 deletions src/template/cjs_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var child_is_dynamic_html = function(child) { return child.type === "unary_hb"
},
get_escaped_html = function(c) {
if(c.nodeType === 3) {
return escapeHTML(c.textContent);
return escapeHTML(getTextContent(c));
} else {
return escapeHTML(c.outerHTML);
}
Expand Down Expand Up @@ -768,9 +768,9 @@ extend(cjs, {
createTemplate: function(template_str) {
if(!isString(template_str)) {
if(is_jquery_obj(template_str) || isNList(template_str)) {
template_str = template_str.length > 0 ? trim(template_str[0].textContent) : "";
template_str = template_str.length > 0 ? trim(getTextContent(template_str[0])) : "";
} else if(isElement(template_str)) {
template_str = trim(template_str.textContent);
template_str = trim(getTextContent(template_str));
} else {
template_str = "" + template_str;
}
Expand Down
12 changes: 11 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var nativeSome = ArrayProto.some,
//Bind a function to a context
var bind = function (func, context) { return function () { return func.apply(context, arguments); }; },
trim = function(str){
return nativeTrim ? nativeTrim.call(str) : String(str).replace(new RegExp(/^\s+|\s+$/, 'g'), '');
return nativeTrim ? nativeTrim.call(str) : String(str).replace(/^\s+|\s+$/g, '');
},
doc = root.document,
sTO = bind(root.setTimeout, root),
Expand All @@ -52,6 +52,16 @@ var bind = function (func, context) { return function () { return func.apply(con
">>>": function (a, b) { return a >>> b;}
};


var getTextContent, setTextContent;
if(doc && !('textContent' in doc.createElement('div'))) {
getTextContent = function(node) { return node.innerText; };
setTextContent = function(node, val) { node.innerText = val; };
} else {
getTextContent = function(node) { return node.textContent; };
setTextContent = function(node, val) { node.textContent = val; };
}

// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};

Expand Down

0 comments on commit 25421c6

Please sign in to comment.