diff options
| -rw-r--r-- | example/temp.html | 14 | ||||
| -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 | ||||
| -rw-r--r-- | test/CompilerSpec.js | 2 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 2 | 
9 files changed, 31 insertions, 32 deletions
| diff --git a/example/temp.html b/example/temp.html index 838a463d..337f7fba 100644 --- a/example/temp.html +++ b/example/temp.html @@ -2,19 +2,9 @@  <html>    <head>      <script type="text/javascript" -         src="http://angularjs.org/ng/js/angular-debug.js"></script> -    <script type="text/javascript"> -      (function(window, previousOnLoad){ -        window.onload = function(){ -          try { -            (previousOnLoad||angular.noop)(); -          } catch(e) {} -          angular.compile(window.document).$init(); -        }; -      })(window, window.onload); -    </script> +         src="../src/angular-bootstrap.js#autobind"></script>    </head> -  <body> +  <body ng:init="$window.$root = this">      Hello {{'World'}}!    </body>  </html> 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'), diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index da354ea5..3736ff4e 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -22,7 +22,7 @@ describe('compiler', function(){      };      textMarkup = [];      attrMarkup = []; -    widgets = {}; +    widgets = extensionMap({}, 'widget');      compiler = new Compiler(textMarkup, attrMarkup, directives, widgets);      compile = function(html){        var e = jqLite("<div>" + html + "</div>"); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 03f31bfe..ad98e482 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -407,7 +407,7 @@ describe("widget", function(){      it("should match sandwich ids", function(){        var scope = {}; -      var match = angular.widget['NG:SWITCH'].route.call(scope, '/a/123/b', '/a/:id'); +      var match = angular.widget('NG:SWITCH').route.call(scope, '/a/123/b', '/a/:id');        expect(match).toBeFalsy();      }); | 
