aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Compiler.js4
-rw-r--r--src/delete/Binder.js76
-rw-r--r--src/delete/Widgets.js4
-rw-r--r--src/directives.js40
-rw-r--r--src/markups.js28
-rw-r--r--src/moveToAngularCom/ControlBar.js4
-rw-r--r--src/widgets.js8
7 files changed, 82 insertions, 82 deletions
diff --git a/src/Compiler.js b/src/Compiler.js
index c8910c27..9faafb13 100644
--- a/src/Compiler.js
+++ b/src/Compiler.js
@@ -121,7 +121,7 @@ Compiler.prototype = {
descend: function(value){ if(isDefined(value)) descend = value; return descend;},
directives: function(value){ if(isDefined(value)) directives = value; return directives;}
};
- priority = element.attr('ng-eval-order') || priority || 0;
+ priority = element.attr('ng:eval-order') || priority || 0;
if (isString(priority)) {
priority = PRIORITY[uppercase(priority)] || 0;
}
@@ -200,7 +200,7 @@ function eachAttribute(element, fn){
var i, attrs = element[0].attributes || [], chld, attr, name, value, attrValue = {};
for (i = 0; i < attrs.length; i++) {
attr = attrs[i];
- name = attr.name.replace(':', '-');
+ name = attr.name;
value = attr.value;
if (msie && name == 'href') {
value = decodeURIComponent(element[0].getAttribute(name, 2));
diff --git a/src/delete/Binder.js b/src/delete/Binder.js
index 9fc32513..095e2b08 100644
--- a/src/delete/Binder.js
+++ b/src/delete/Binder.js
@@ -112,24 +112,24 @@ Binder.prototype = {
},
executeInit: function() {
- this.docFindWithSelf("[ng-init]").each(function() {
+ this.docFindWithSelf("[ng:init]").each(function() {
var jThis = jQuery(this);
var scope = jThis.scope();
try {
- scope.eval(jThis.attr('ng-init'));
+ scope.eval(jThis.attr('ng:init'));
} catch (e) {
- alert("EVAL ERROR:\n" + jThis.attr('ng-init') + '\n' + toJson(e, true));
+ alert("EVAL ERROR:\n" + jThis.attr('ng:init') + '\n' + toJson(e, true));
}
});
},
entity: function (scope) {
var self = this;
- this.docFindWithSelf("[ng-entity]").attr("ng-watch", function() {
+ this.docFindWithSelf("[ng-entity]").attr("ng:watch", function() {
try {
var jNode = jQuery(this);
var decl = scope.entity(jNode.attr("ng-entity"), self.datastore);
- return decl + (jNode.attr('ng-watch') || "");
+ return decl + (jNode.attr('ng:watch') || "");
} catch (e) {
log(e);
alert(e);
@@ -142,7 +142,7 @@ Binder.prototype = {
if (this.config['autoSubmit']) {
var submits = this.docFindWithSelf(":submit").not("[ng-action]");
submits.attr("ng-action", "$save()");
- submits.not(":disabled").not("ng-bind-attr").attr("ng-bind-attr", '{disabled:"{{$invalidWidgets}}"}');
+ submits.not(":disabled").not("ng:bind-attr").attr("ng:bind-attr", '{disabled:"{{$invalidWidgets}}"}');
}
this.precompile(this.doc)(this.doc, jNode.scope(), "");
this.docFindWithSelf("a[ng-action]").live('click', function (event) {
@@ -168,9 +168,9 @@ Binder.prototype = {
if (parts.length > 1 || Binder.binding(parts[0])) {
var parent = node.parentNode;
if (isLeafNode(parent)) {
- parent.setAttribute('ng-bind-template', node.nodeValue);
+ parent.setAttribute('ng:bind-template', node.nodeValue);
factories.push({path:path, fn:function(node, scope, prefix) {
- return new BindUpdater(node, node.getAttribute('ng-bind-template'));
+ return new BindUpdater(node, node.getAttribute('ng:bind-template'));
}});
} else {
for (var i = 0; i < parts.length; i++) {
@@ -180,7 +180,7 @@ Binder.prototype = {
if (binding) {
newNode = document.createElement("span");
var jNewNode = jQuery(newNode);
- jNewNode.attr("ng-bind", binding);
+ jNewNode.attr("ng:bind", binding);
if (i === 0) {
factories.push({path:path.concat(offset + i), fn:this.ng_bind});
}
@@ -228,13 +228,13 @@ Binder.prototype = {
}
if (!node.getAttribute) return;
- var nonBindable = node.getAttribute('ng-non-bindable');
+ var nonBindable = node.getAttribute('ng:non-bindable');
if (nonBindable || nonBindable === "") return;
var attributes = node.attributes;
if (attributes) {
- var bindings = node.getAttribute('ng-bind-attr');
- node.removeAttribute('ng-bind-attr');
+ var bindings = node.getAttribute('ng:bind-attr');
+ node.removeAttribute('ng:bind-attr');
bindings = bindings ? fromJson(bindings) : {};
var attrLen = attributes.length;
for (var i = 0; i < attrLen; i++) {
@@ -249,23 +249,23 @@ Binder.prototype = {
}
var json = toJson(bindings);
if (json.length > 2) {
- node.setAttribute("ng-bind-attr", json);
+ node.setAttribute("ng:bind-attr", json);
}
}
if (!node.getAttribute) log(node);
- var repeaterExpression = node.getAttribute('ng-repeat');
+ var repeaterExpression = node.getAttribute('ng:repeat');
if (repeaterExpression) {
- node.removeAttribute('ng-repeat');
+ node.removeAttribute('ng:repeat');
var precompiled = this.precompile(node);
- var view = document.createComment("ng-repeat: " + repeaterExpression);
+ var view = document.createComment("ng:repeat: " + repeaterExpression);
var parentNode = node.parentNode;
parentNode.insertBefore(view, node);
parentNode.removeChild(node);
function template(childScope, prefix, i) {
var clone = jQuery(node).clone();
clone.css('display', '');
- clone.attr('ng-repeat-index', "" + i);
+ clone.attr('ng:repeat-index', "" + i);
clone.data('scope', childScope);
precompiled(clone[0], childScope, prefix + i + ":");
return clone;
@@ -276,16 +276,16 @@ Binder.prototype = {
return;
}
- if (node.getAttribute('ng-eval')) factories.push({path:path, fn:this.ng_eval});
- if (node.getAttribute('ng-bind')) factories.push({path:path, fn:this.ng_bind});
- if (node.getAttribute('ng-bind-attr')) factories.push({path:path, fn:this.ng_bind_attr});
- if (node.getAttribute('ng-hide')) factories.push({path:path, fn:this.ng_hide});
- if (node.getAttribute('ng-show')) factories.push({path:path, fn:this.ng_show});
- if (node.getAttribute('ng-class')) factories.push({path:path, fn:this.ng_class});
- if (node.getAttribute('ng-class-odd')) factories.push({path:path, fn:this.ng_class_odd});
- if (node.getAttribute('ng-class-even')) factories.push({path:path, fn:this.ng_class_even});
- if (node.getAttribute('ng-style')) factories.push({path:path, fn:this.ng_style});
- if (node.getAttribute('ng-watch')) factories.push({path:path, fn:this.ng_watch});
+ if (node.getAttribute('ng:eval')) factories.push({path:path, fn:this.ng_eval});
+ if (node.getAttribute('ng:bind')) factories.push({path:path, fn:this.ng_bind});
+ if (node.getAttribute('ng:bind-attr')) factories.push({path:path, fn:this.ng_bind_attr});
+ if (node.getAttribute('ng:hide')) factories.push({path:path, fn:this.ng_hide});
+ if (node.getAttribute('ng:show')) factories.push({path:path, fn:this.ng_show});
+ if (node.getAttribute('ng:class')) factories.push({path:path, fn:this.ng_class});
+ if (node.getAttribute('ng:class-odd')) factories.push({path:path, fn:this.ng_class_odd});
+ if (node.getAttribute('ng:class-even')) factories.push({path:path, fn:this.ng_class_even});
+ if (node.getAttribute('ng:style')) factories.push({path:path, fn:this.ng_style});
+ if (node.getAttribute('ng:watch')) factories.push({path:path, fn:this.ng_watch});
var nodeName = node.nodeName;
if ((nodeName == 'INPUT' ) ||
nodeName == 'TEXTAREA' ||
@@ -301,7 +301,7 @@ Binder.prototype = {
var html = jQuery('<select/>').append(jQuery(node).clone()).html();
if (!html.match(/<option(\s.*\s|\s)value\s*=\s*.*>.*<\/\s*option\s*>/gi)) {
if (Binder.hasBinding(node.text)) {
- jQuery(node).attr('ng-bind-attr', angular.toJson({'value':node.text}));
+ jQuery(node).attr('ng:bind-attr', angular.toJson({'value':node.text}));
} else {
node.value = node.text;
}
@@ -315,42 +315,42 @@ Binder.prototype = {
},
ng_eval: function(node) {
- return new EvalUpdater(node, node.getAttribute('ng-eval'));
+ return new EvalUpdater(node, node.getAttribute('ng:eval'));
},
ng_bind: function(node) {
- return new BindUpdater(node, "{{" + node.getAttribute('ng-bind') + "}}");
+ return new BindUpdater(node, "{{" + node.getAttribute('ng:bind') + "}}");
},
ng_bind_attr: function(node) {
- return new BindAttrUpdater(node, fromJson(node.getAttribute('ng-bind-attr')));
+ return new BindAttrUpdater(node, fromJson(node.getAttribute('ng:bind-attr')));
},
ng_hide: function(node) {
- return new HideUpdater(node, node.getAttribute('ng-hide'));
+ return new HideUpdater(node, node.getAttribute('ng:hide'));
},
ng_show: function(node) {
- return new ShowUpdater(node, node.getAttribute('ng-show'));
+ return new ShowUpdater(node, node.getAttribute('ng:show'));
},
ng_class: function(node) {
- return new ClassUpdater(node, node.getAttribute('ng-class'));
+ return new ClassUpdater(node, node.getAttribute('ng:class'));
},
ng_class_even: function(node) {
- return new ClassEvenUpdater(node, node.getAttribute('ng-class-even'));
+ return new ClassEvenUpdater(node, node.getAttribute('ng:class-even'));
},
ng_class_odd: function(node) {
- return new ClassOddUpdater(node, node.getAttribute('ng-class-odd'));
+ return new ClassOddUpdater(node, node.getAttribute('ng:class-odd'));
},
ng_style: function(node) {
- return new StyleUpdater(node, node.getAttribute('ng-style'));
+ return new StyleUpdater(node, node.getAttribute('ng:style'));
},
ng_watch: function(node, scope) {
- scope.watch(node.getAttribute('ng-watch'));
+ scope.watch(node.getAttribute('ng:watch'));
}
};
diff --git a/src/delete/Widgets.js b/src/delete/Widgets.js
index 96b63793..d2f0c75a 100644
--- a/src/delete/Widgets.js
+++ b/src/delete/Widgets.js
@@ -99,7 +99,7 @@ angularCallbacks['flashEvent'] = function(id, event, args) {
FileController.template = function(id) {
return jQuery('<span class="ng-upload-widget">' +
- '<input type="checkbox" ng-non-bindable="true"/>' +
+ '<input type="checkbox" ng:non-bindable="true"/>' +
'<object id="' + id + '" />' +
'<a></a>' +
'<span/>' +
@@ -640,7 +640,7 @@ function RepeaterUpdater(view, repeaterExpression, template, prefix) {
this.children = [];
var match = repeaterExpression.match(/^\s*(.+)\s+in\s+(.*)\s*$/);
if (! match) {
- throw "Expected ng-repeat in form of 'item in collection' but got '" +
+ throw "Expected ng:repeat in form of 'item in collection' but got '" +
repeaterExpression + "'.";
}
var keyValue = match[1];
diff --git a/src/directives.js b/src/directives.js
index cabf0c23..1b422331 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -1,10 +1,10 @@
-angularDirective("ng-init", function(expression){
+angularDirective("ng:init", function(expression){
return function(element){
this.$tryEval(expression, element);
};
});
-angularDirective("ng-controller", function(expression){
+angularDirective("ng:controller", function(expression){
return function(element){
var controller = getter(window, expression, true) || getter(this, expression, true);
if (!controller)
@@ -16,13 +16,13 @@ angularDirective("ng-controller", function(expression){
};
});
-angularDirective("ng-eval", function(expression){
+angularDirective("ng:eval", function(expression){
return function(element){
this.$onEval(expression, element);
};
});
-angularDirective("ng-bind", function(expression){
+angularDirective("ng:bind", function(expression){
return function(element) {
var lastValue = noop, lastError = noop;
this.$onEval(function() {
@@ -89,7 +89,7 @@ function compileBindTemplate(template){
return fn;
}
-angularDirective("ng-bind-template", function(expression){
+angularDirective("ng:bind-template", function(expression){
var templateFn = compileBindTemplate(expression);
return function(element) {
var lastValue;
@@ -108,7 +108,7 @@ var REMOVE_ATTRIBUTES = {
'readonly':'readOnly',
'checked':'checked'
};
-angularDirective("ng-bind-attr", function(expression){
+angularDirective("ng:bind-attr", function(expression){
return function(element){
var lastValue = {};
this.$onEval(function(){
@@ -134,17 +134,17 @@ angularDirective("ng-bind-attr", function(expression){
};
});
-angularWidget("@ng-non-bindable", noop);
+angularWidget("@ng:non-bindable", noop);
-angularWidget("@ng-repeat", function(expression, element){
- element.removeAttr('ng-repeat');
- element.replaceWith(this.comment("ng-repeat: " + expression));
+angularWidget("@ng:repeat", function(expression, element){
+ element.removeAttr('ng:repeat');
+ element.replaceWith(this.comment("ng:repeat: " + expression));
var template = this.compile(element);
return function(reference){
var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/),
lhs, rhs, valueIdent, keyIdent;
if (! match) {
- throw "Expected ng-repeat in form of 'item in collection' but got '" +
+ throw "Expected ng:repeat in form of 'item in collection' but got '" +
expression + "'.";
}
lhs = match[1];
@@ -176,7 +176,7 @@ angularWidget("@ng-repeat", function(expression, element){
if (keyIdent) childScope[keyIdent] = key;
lastElement.after(childScope.$element);
childScope.$index = index;
- childScope.$element.attr('ng-repeat-index', index);
+ childScope.$element.attr('ng:repeat-index', index);
childScope.$init();
children.push(childScope);
}
@@ -192,7 +192,7 @@ angularWidget("@ng-repeat", function(expression, element){
};
});
-angularDirective("ng-click", function(expression, element){
+angularDirective("ng:click", function(expression, element){
return function(element){
var self = this;
element.bind('click', function(){
@@ -203,7 +203,7 @@ angularDirective("ng-click", function(expression, element){
};
});
-angularDirective("ng-watch", function(expression, element){
+angularDirective("ng:watch", function(expression, element){
return function(element){
var self = this;
new Parser(expression).watch()({
@@ -231,11 +231,11 @@ function ngClass(selector) {
};
}
-angularDirective("ng-class", ngClass(function(){return true;}));
-angularDirective("ng-class-odd", ngClass(function(i){return i % 2 === 0;}));
-angularDirective("ng-class-even", ngClass(function(i){return i % 2 === 1;}));
+angularDirective("ng:class", ngClass(function(){return true;}));
+angularDirective("ng:class-odd", ngClass(function(i){return i % 2 === 0;}));
+angularDirective("ng:class-even", ngClass(function(i){return i % 2 === 1;}));
-angularDirective("ng-show", function(expression, element){
+angularDirective("ng:show", function(expression, element){
return function(element){
this.$onEval(function(){
element.css('display', toBoolean(this.$eval(expression)) ? '' : 'none');
@@ -243,7 +243,7 @@ angularDirective("ng-show", function(expression, element){
};
});
-angularDirective("ng-hide", function(expression, element){
+angularDirective("ng:hide", function(expression, element){
return function(element){
this.$onEval(function(){
element.css('display', toBoolean(this.$eval(expression)) ? 'none' : '');
@@ -251,7 +251,7 @@ angularDirective("ng-hide", function(expression, element){
};
});
-angularDirective("ng-style", function(expression, element){
+angularDirective("ng:style", function(expression, element){
return function(element){
this.$onEval(function(){
element.css(this.$eval(expression));
diff --git a/src/markups.js b/src/markups.js
index 74b293b8..ac2b5636 100644
--- a/src/markups.js
+++ b/src/markups.js
@@ -32,14 +32,14 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {
self = this;
if (hasBindings(bindings)) {
if (isLeafNode(parentElement[0])) {
- parentElement.attr('ng-bind-template', text);
+ parentElement.attr('ng:bind-template', text);
} else {
var cursor = textNode, newElement;
foreach(parseBindings(text), function(text){
var exp = binding(text);
if (exp) {
newElement = self.element('span');
- newElement.attr('ng-bind', exp);
+ newElement.attr('ng:bind', exp);
} else {
newElement = self.text(text);
}
@@ -68,18 +68,18 @@ angularTextMarkup('OPTION', function(text, textNode, parentElement){
}
});
-var NG_BIND_ATTR = 'ng-bind-attr';
+var NG_BIND_ATTR = 'ng:bind-attr';
angularAttrMarkup('{{}}', function(value, name, element){
- if (name.substr(0, 3) != 'ng-') {
- if (msie && name == 'src')
- value = decodeURI(value);
- var bindings = parseBindings(value),
- bindAttr;
- if (hasBindings(bindings)) {
- element.removeAttr(name);
- bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}");
- bindAttr[name] = value;
- element.attr(NG_BIND_ATTR, toJson(bindAttr));
- }
+ // don't process existing attribute markup
+ if (angularDirective(name) || angularDirective("@" + name)) return;
+ if (msie && name == 'src')
+ value = decodeURI(value);
+ var bindings = parseBindings(value),
+ bindAttr;
+ if (hasBindings(bindings)) {
+ element.removeAttr(name);
+ bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}");
+ bindAttr[name] = value;
+ element.attr(NG_BIND_ATTR, toJson(bindAttr));
}
});
diff --git a/src/moveToAngularCom/ControlBar.js b/src/moveToAngularCom/ControlBar.js
index 685beeb2..b9a2de8a 100644
--- a/src/moveToAngularCom/ControlBar.js
+++ b/src/moveToAngularCom/ControlBar.js
@@ -9,14 +9,14 @@ function ControlBar(document, serverUrl, database) {
ControlBar.HTML =
'<div>' +
'<div class="ui-widget-overlay"></div>' +
- '<div id="ng-login" ng-non-bindable="true">' +
+ '<div id="ng-login" ng:non-bindable="true">' +
'<div class="ng-login-container"></div>' +
'</div>' +
'</div>';
ControlBar.FORBIDEN =
- '<div ng-non-bindable="true" title="Permission Error:">' +
+ '<div ng:non-bindable="true" title="Permission Error:">' +
'Sorry, you do not have permission for this!'+
'</div>';
diff --git a/src/widgets.js b/src/widgets.js
index efafa9c5..94f09c7b 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -196,7 +196,7 @@ function inputWidget(events, modelAccessor, viewAccessor, initFn) {
action = element.attr('ng-change') || '',
lastValue;
initFn.call(scope, model, view, element);
- this.$eval(element.attr('ng-init')||'');
+ this.$eval(element.attr('ng:init')||'');
// Don't register a handler if we are a button (noopAccessor) and there is no action
if (action || modelAccessor !== noopAccessor) {
element.bind(events, function(){
@@ -236,11 +236,11 @@ angularWidget('NG:INCLUDE', function(element){
var compiler = this,
srcExp = element.attr("src"),
scopeExp = element.attr("scope") || '';
- if (element[0]['ng-compiled']) {
+ if (element[0]['ng:compiled']) {
this.descend(true);
this.directives(true);
} else {
- element[0]['ng-compiled'] = true;
+ element[0]['ng:compiled'] = true;
return function(element){
var scope = this, childScope;
var changeCounter = 0;
@@ -276,7 +276,7 @@ var ngSwitch = angularWidget('NG:SWITCH', function (element){
cases = [];
if (!usingFn) throw "Using expression '" + usingExpr + "' unknown.";
eachNode(element, function(caseElement){
- var when = caseElement.attr('ng-switch-when');
+ var when = caseElement.attr('ng:switch-when');
if (when) {
cases.push({
when: function(scope, value){