aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMisko Hevery2010-04-22 17:11:56 -0700
committerMisko Hevery2010-04-22 17:11:56 -0700
commitfe434307d15d697a5ffade51bad068f6443965b2 (patch)
tree64ca5ea2afee38d79ac973ffad4bf6902d6449a6 /src
parent2a9669e1d853d4e18d2eb1f07e84ee5baec838c2 (diff)
downloadangular.js-fe434307d15d697a5ffade51bad068f6443965b2.tar.bz2
tests work under jquery and without
Diffstat (limited to 'src')
-rw-r--r--src/Angular.js6
-rw-r--r--src/directives.js9
-rw-r--r--src/filters.js6
-rw-r--r--src/jqLite.js4
-rw-r--r--src/widgets.js2
5 files changed, 12 insertions, 15 deletions
diff --git a/src/Angular.js b/src/Angular.js
index a4421f0e..0c1ab838 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -112,7 +112,11 @@ function lowercase(value){ return isString(value) ? value.toLowerCase() : value;
function uppercase(value){ return isString(value) ? value.toUpperCase() : value; }
function trim(value) { return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; }
function isElement(node) {
- return node && (node.nodeName || node instanceof JQLite || node instanceof jQuery);
+ return node && (node.nodeName || node instanceof JQLite || (jQuery && node instanceof jQuery));
+}
+
+function HTML(html) {
+ this.html = html;
}
if (msie) {
diff --git a/src/directives.js b/src/directives.js
index bdcdcc1d..aa75aa5b 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -30,8 +30,8 @@ angularDirective("ng-bind", function(expression){
value = this.$tryEval(expression, function(e){
error = toJson(e);
}),
- isElem = isElement(value);
- if (!isElem && isObject(value)) {
+ isHtml = value instanceof HTML;
+ if (!isHtml && isObject(value)) {
value = toJson(value);
}
if (value != lastValue || error != lastError) {
@@ -39,9 +39,8 @@ angularDirective("ng-bind", function(expression){
lastError = error;
elementError(element, NG_EXCEPTION, error);
if (error) value = error;
- if (isElem) {
- element.html('');
- element.append(value);
+ if (isHtml) {
+ element.html(value.html);
} else {
element.text(value);
}
diff --git a/src/filters.js b/src/filters.js
index 74013db1..a911b935 100644
--- a/src/filters.js
+++ b/src/filters.js
@@ -269,9 +269,7 @@ foreach({
},
'html': function(html){
- var div = jqLite('div');
- div.html(html);
- return div.children();
+ return new HTML(html);
},
'linky': function(text){
@@ -293,7 +291,7 @@ foreach({
raw = raw.substring(i + url.length);
}
html.push(escapeHtml(raw));
- return jqLite(html.join(''));
+ return new HTML(html.join(''));
}
}, function(v,k){angularFilter[k] = v;});
diff --git a/src/jqLite.js b/src/jqLite.js
index ec1c52d2..18589630 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -238,10 +238,6 @@ if (msie) {
},
trigger: function(type) {
-
- if (nodeName(this) == 'INPUT' && (lowercase(this.attr('type')) == 'radio' || lowercase(this.attr('type')) == 'checkbox')) {
- this[0].checked = ! this[0].checked;
- }
this[0].fireEvent('on' + type);
}
});
diff --git a/src/widgets.js b/src/widgets.js
index 239f12f8..209b24b7 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -32,7 +32,7 @@ function valueAccessor(scope, element) {
value = element.val();
force = true;
}
- if (element[0].disabled || isString(element.attr('readonly'))) {
+ if (element[0].disabled || element[0].readOnly) {
elementError(element, NG_VALIDATION_ERROR, null);
invalidWidgets.markValid(element);
return value;