aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
authorMisko Hevery2010-03-24 16:13:42 -0700
committerMisko Hevery2010-03-24 16:13:42 -0700
commit0c42eb9909d554807549cd3394e0ea0c715cc2d1 (patch)
tree331c637a5c86b87970166a0936874fec9c6920a6 /src/jqLite.js
parent3d3694240034b6841c9fdf2e38a2a7955cb592c7 (diff)
downloadangular.js-0c42eb9909d554807549cd3394e0ea0c715cc2d1.tar.bz2
input[type=text] now works with binding, validation, formatter, required
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 035a7a1b..2ac3f6c9 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -77,22 +77,24 @@ JQLite.prototype = {
},
bind: function(type, fn){
- var element = this[0],
- bind = this.data('bind'),
+ var self = this,
+ element = self[0],
+ bind = self.data('bind'),
eventHandler;
if (!bind) this.data('bind', bind = {});
- eventHandler = bind[type];
- if (!eventHandler) {
- bind[type] = eventHandler = function() {
- var self = this;
- foreach(eventHandler.fns, function(fn){
- fn.apply(self, arguments);
- });
- };
- eventHandler.fns = [];
- addEventListener(element, type, eventHandler);
- }
- eventHandler.fns.push(fn);
+ foreach(type.split(' '), function(type){
+ eventHandler = bind[type];
+ if (!eventHandler) {
+ bind[type] = eventHandler = function() {
+ foreach(eventHandler.fns, function(fn){
+ fn.apply(self, arguments);
+ });
+ };
+ eventHandler.fns = [];
+ addEventListener(element, type, eventHandler);
+ }
+ eventHandler.fns.push(fn);
+ });
},
trigger: function(type) {
@@ -134,6 +136,10 @@ JQLite.prototype = {
return false;
},
+ removeClass: function(selector) {
+ this[0].className = trim((" " + this[0].className + " ").replace(/[\n\t]/g, " ").replace(" " + selector + " ", ""));
+ },
+
addClass: function( selector ) {
if (!this.hasClass(selector)) {
this[0].className += ' ' + selector;