diff options
| author | Misko Hevery | 2010-03-26 16:27:18 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-03-26 16:27:18 -0700 |
| commit | 258ca5f16581f0e8befa493644225a02ae2fc002 (patch) | |
| tree | a7d67c586fb5c870619664ca84e17996f6dd2e6d /src/jqLite.js | |
| parent | 1990cbbf2817e04657ccd616da1d9d6b78cc2949 (diff) | |
| download | angular.js-258ca5f16581f0e8befa493644225a02ae2fc002.tar.bz2 | |
moved all uneeded files out, widgets.html works, tests horribly broken
Diffstat (limited to 'src/jqLite.js')
| -rw-r--r-- | src/jqLite.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/jqLite.js b/src/jqLite.js index 7646bf98..a5014354 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -38,7 +38,8 @@ function JQLite(element) { this[0] = element; } -function jqLite(element) { + +function jqLiteWrap(element) { if (typeof element == 'string') { var div = document.createElement('div'); div.innerHTML = element; @@ -47,6 +48,8 @@ function jqLite(element) { return element instanceof JQLite ? element : new JQLite(element); } +jqLite = jqLite || jqLiteWrap; + JQLite.prototype = { data: function(key, value) { var element = this[0], @@ -85,12 +88,15 @@ JQLite.prototype = { foreach(type.split(' '), function(type){ eventHandler = bind[type]; if (!eventHandler) { - bind[type] = eventHandler = function() { - var value = false; + bind[type] = eventHandler = function(event) { + var bubbleEvent = false; foreach(eventHandler.fns, function(fn){ - value = value || fn.apply(self, arguments); + bubbleEvent = bubbleEvent || fn.apply(self, arguments); }); - return value; + if (!bubbleEvent) { + event.preventDefault(); + event.stopPropagation(); + } }; eventHandler.fns = []; addEventListener(element, type, eventHandler); |
