diff options
| author | Misko Hevery | 2010-07-20 16:55:32 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-07-20 16:55:32 -0700 |
| commit | bebfbeac0a3f25b3d0df00ada5c919adef9dd701 (patch) | |
| tree | 9d985f8c357dbcbc6f24a8c348c1336d2c32d99c /src | |
| parent | 7e96af0fdd9af8c479992363f68578305df0337e (diff) | |
| download | angular.js-bebfbeac0a3f25b3d0df00ada5c919adef9dd701.tar.bz2 | |
fixed xhtml compatibility, fix console in chrome
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 7 | ||||
| -rw-r--r-- | src/AngularPublic.js | 2 | ||||
| -rw-r--r-- | src/Compiler.js | 11 | ||||
| -rw-r--r-- | src/apis.js | 1 | ||||
| -rw-r--r-- | src/services.js | 12 | ||||
| -rw-r--r-- | src/widgets.js | 12 |
6 files changed, 27 insertions, 18 deletions
diff --git a/src/Angular.js b/src/Angular.js index e39e31c9..8c0b591d 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -22,7 +22,7 @@ var consoleNode, angularTextMarkup = extensionMap(angular, 'textMarkup'), angularAttrMarkup = extensionMap(angular, 'attrMarkup'), angularDirective = extensionMap(angular, 'directive'), - angularWidget = extensionMap(angular, 'widget'), + angularWidget = extensionMap(angular, 'widget', lowercase), angularValidator = extensionMap(angular, 'validator'), angularFilter = extensionMap(angular, 'filter'), angularFormatter = extensionMap(angular, 'formatter'), @@ -84,9 +84,10 @@ function inherit(parent, extra) { function noop() {} function identity($) {return $;} -function extensionMap(angular, name) { +function extensionMap(angular, name, transform) { var extPoint; return angular[name] || (extPoint = angular[name] = function (name, fn, prop){ + name = (transform || identity)(name); if (isDefined(fn)) { extPoint[name] = extend(fn, prop || {}); } @@ -419,7 +420,7 @@ function angularInit(config){ function angularJsConfig(document) { var filename = /(.*)\/angular(-(.*))?.js(#(.*))?/, - scripts = document.getElementsByTagName("SCRIPT"), + scripts = document.getElementsByTagName("script"), match; for(var j = 0; j < scripts.length; j++) { match = (scripts[j].src || "").match(filename); diff --git a/src/AngularPublic.js b/src/AngularPublic.js index 817a1f93..e2e576fd 100644 --- a/src/AngularPublic.js +++ b/src/AngularPublic.js @@ -18,6 +18,8 @@ extend(angular, { 'foreach': foreach, 'noop':noop, 'bind':bind, + 'toJson': toJson, + 'fromJson': fromJson, 'identity':identity, 'isUndefined': isUndefined, 'isDefined': isDefined, diff --git a/src/Compiler.js b/src/Compiler.js index 9faafb13..a6fd88ec 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -121,20 +121,25 @@ 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; + try { + priority = element.attr('ng:eval-order') || priority || 0; + } catch (e) { + // for some reason IE throws error under some weird circumstances. so just assume nothing + priority = priority || 0; + } if (isString(priority)) { priority = PRIORITY[uppercase(priority)] || 0; } template = new Template(priority); eachAttribute(element, function(value, name){ if (!widget) { - if (widget = self.widgets['@' + name]) { + if (widget = self.widgets('@' + name)) { widget = bind(selfApi, widget, value, element); } } }); if (!widget) { - if (widget = self.widgets[nodeName(element)]) { + if (widget = self.widgets(nodeName(element))) { widget = bind(selfApi, widget, element); } } diff --git a/src/apis.js b/src/apis.js index 2d0c571e..136473b6 100644 --- a/src/apis.js +++ b/src/apis.js @@ -12,6 +12,7 @@ var angularGlobal = { }; var angularCollection = { + 'copy': copy, 'size': size, 'equals': equals }; diff --git a/src/services.js b/src/services.js index ed6f73ad..c9799b32 100644 --- a/src/services.js +++ b/src/services.js @@ -65,13 +65,13 @@ angularService("$location", function(browser){ }, {inject: ['$browser']}); angularService("$log", function($window){ - var console = $window.console, - log = console && console.log || noop; + var console = $window.console || {log: noop, warn: noop, info: noop, error: noop}, + log = console.log || noop; return { - log: log, - warn: console && console.warn || log, - info: console && console.info || log, - error: console && console.error || log + log: bind(console, log), + warn: bind(console, console.warn || log), + info: bind(console, console.info || log), + error: bind(console, console.error || log) }; }, {inject:['$window']}); diff --git a/src/widgets.js b/src/widgets.js index 7bd51c8c..5f0fcf7c 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -222,16 +222,16 @@ function inputWidgetSelector(element){ return INPUT_TYPE[lowercase(element[0].type)] || noop; } -angularWidget('INPUT', inputWidgetSelector); -angularWidget('TEXTAREA', inputWidgetSelector); -angularWidget('BUTTON', inputWidgetSelector); -angularWidget('SELECT', function(element){ +angularWidget('input', inputWidgetSelector); +angularWidget('textarea', inputWidgetSelector); +angularWidget('button', inputWidgetSelector); +angularWidget('select', function(element){ this.descend(true); return inputWidgetSelector.call(this, element); }); -angularWidget('NG:INCLUDE', function(element){ +angularWidget('ng:include', function(element){ var compiler = this, srcExp = element.attr("src"), scopeExp = element.attr("scope") || ''; @@ -265,7 +265,7 @@ angularWidget('NG:INCLUDE', function(element){ } }); -var ngSwitch = angularWidget('NG:SWITCH', function (element){ +var ngSwitch = angularWidget('ng:switch', function (element){ var compiler = this, watchExpr = element.attr("on"), usingExpr = (element.attr("using") || 'equals'), |
