mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 03:30:02 +08:00
tests work under jquery and without
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;});
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user