Comparing version 0.2.51 to 0.2.52
@@ -64,8 +64,18 @@ /** | ||
/** | ||
* For adding client-side directives, so we can strip them when we need do, but also not process on server | ||
* @param name | ||
*/ | ||
function addIgnoredDirective(name) { | ||
runtime.transformsIgnored[name] = function () {}; | ||
} | ||
// expose functions | ||
module.exports = { | ||
transforms: runtime.transforms, | ||
transformsIgnored: runtime.transformsIgnored, | ||
init: init, | ||
addDirective: addDirective | ||
addDirective: addDirective, | ||
addIgnoredDirective: addIgnoredDirective | ||
}; |
@@ -54,3 +54,4 @@ /** | ||
addDirective: directives.addDirective, | ||
addIgnoredDirective: directives.addIgnoredDirective, | ||
addFilters: filters.addFilters | ||
}; |
@@ -16,2 +16,3 @@ /** | ||
var transforms = {}; | ||
var transformsIgnored = {}; // for client-side directives- we need to strip them, but also not actually angularize them server-side | ||
var repeatStmtCache = {}; | ||
@@ -53,3 +54,3 @@ | ||
// if no transform, continue to next attribute | ||
if (!transforms[attrNormal]) { | ||
if (!(transforms[attrNormal] || transformsIgnored[attrNormal])) { | ||
@@ -63,15 +64,17 @@ // if there are brackets, they will be evaluated | ||
// get the value and see if the attr name is a filter (i.e. f-) | ||
isFilterAttr = attr.charAt(0) === 'f' && attr.charAt(1) === '-'; | ||
if ( transforms[attrNormal] ) { | ||
// get the value and see if the attr name is a filter (i.e. f-) | ||
isFilterAttr = attr.charAt(0) === 'f' && attr.charAt(1) === '-'; | ||
// as long as not f-, we will want to try and evaluate the attribute value | ||
evaled = isFilterAttr ? null : parser.parse(attrValue, scope, savedFilters); | ||
// as long as not f-, we will want to try and evaluate the attribute value | ||
evaled = isFilterAttr ? null : parser.parse(attrValue, scope, savedFilters); | ||
// these are set up so that in the transform below, | ||
// the directive link fn will have access to the attribute value | ||
transScope = jytToJng.getDirectiveScope(scope, attrValue, evaled); | ||
transAttrs = jytToJng.getDirectiveAttrs(e, attrNormal, evaled); | ||
// these are set up so that in the transform below, | ||
// the directive link fn will have access to the attribute value | ||
transScope = jytToJng.getDirectiveScope(scope, attrValue, evaled); | ||
transAttrs = jytToJng.getDirectiveAttrs(e, attrNormal, evaled); | ||
// now run the transform function (i.e. directive link() fn) to modify the element | ||
transforms[attrNormal](transScope, transElement, transAttrs, evaled, attrValue); | ||
// now run the transform function (i.e. directive link() fn) to modify the element | ||
transforms[attrNormal](transScope, transElement, transAttrs, evaled, attrValue); | ||
} | ||
@@ -81,10 +84,7 @@ // failsafe in case transform removed the attributes | ||
// if we are stripping attributes and this on starts ng- or is in transforms, remove it | ||
// if we are stripping attributes and this one starts ng- or is in transforms, remove it | ||
if (scope[JNG_STRIP] === true && e.attributes.hasOwnProperty(attr) && | ||
(attr === 'gh-validate' || | ||
attr === 'typeahead' || | ||
attr.indexOf('ng-') === 0 || | ||
transforms.hasOwnProperty(attr)) | ||
(attr.indexOf('ng-') === 0 || transforms.hasOwnProperty(attr) || transformsIgnored.hasOwnProperty(attr)) | ||
//attr === 'gh-validate' || attr === 'typeahead' || | ||
) { | ||
delete e.attributes[attr]; | ||
@@ -189,4 +189,5 @@ } | ||
transforms: transforms, | ||
transformsIgnored: transformsIgnored, | ||
angularizeAttrs: angularizeAttrs, | ||
angularize: angularize | ||
}; |
{ | ||
"name": "jangular", | ||
"version": "0.2.51", | ||
"version": "0.2.52", | ||
"description": "JavaScript based templating engine for Angular", | ||
@@ -5,0 +5,0 @@ "main": "lib/jangular.js", |
111245
2665