From 27709c3f69384a7630aa336a1e73e730ea5f9790 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 12 Jan 2010 14:19:19 -0800 Subject: break out init phase into scope --- angular-minified.js | 188 ++++++++++++++++++++++++------------------------ angular.js | 10 ++- src/Loader.js | 10 ++- test/ExternalApiTest.js | 1 + 4 files changed, 103 insertions(+), 106 deletions(-) diff --git a/angular-minified.js b/angular-minified.js index 775576b9..e49e0324 100644 --- a/angular-minified.js +++ b/angular-minified.js @@ -1,98 +1,98 @@ function J(){return function(){}}function K(p){return function(){return p}} -(function(p,z){function n(){}function r(a,b,c){var d=p.console;switch(arguments.length){case 1:d.log(a);break;case 2:d.log(a,b);break;default:d.log(a,b,c);break}}function W(a,b,c){var d=p.console;switch(arguments.length){case 1:d.error(a);break;case 2:d.error(a,b);break;default:d.error(a,b,c);break}}function da(a,b){var c=z.createElement("div");c.className=a;for(var d=a="",e=0;e/g,">")}function Ca(a){if(!a||!a.replace)return a;return a.replace(//g,">").replace(/\"/g,""")}function Da(a,b){if(!a)throw"Missing this";if(!_.isFunction(b))throw"Missing function";return function(){return b.apply(a,arguments)}}function Ea(a,b){return function(){for(var c= -[this],d=0;d>2;c=(c&3)<<4|d>>4;g=(d&15)<<2|e>>6;h=e&63;if(isNaN(d))g=h=64;else if(isNaN(e))h= -64;b=b+this.u.charAt(f)+this.u.charAt(c)+this.u.charAt(g)+this.u.charAt(h)}return b},rd:function(a){var b="",c,d,e,f,g,h=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");h>4;d=(d&15)<<4|f>>2;e=(f&3)<<6|g;b+=String.fromCharCode(c);if(f!=64)b+=String.fromCharCode(d);if(g!=64)b+=String.fromCharCode(e)}return b=ba.nb(b)},ob:function(a){a=a.replace(/\r\n/g,"\n"); +a;this.R(b||{});this.Q=a.title;this.fb()}function F(a,b){this.text=a;this.Hb=b?20:-1;this.g=[];this.index=0}function D(a,b){this.text=a;this.g=(new F(a,b)).parse();this.index=0}function w(a,b){this.cb=[];this.pa={};this.name=b;a=a||{};function c(){}c.prototype=a;this.q=new c;this.q.Rc=a;if(b=="ROOT")this.q.Sc=this.q}function ja(a,b){this.url=a;this.ec=0;this.getScript=b;this.Hc="_"+(""+Math.random()).substr(2)+"_";this.ka=1800}function aa(a){this.frame=a}function ka(a,b,c){this.Jb=a;this.update=c; +this.status=b}function la(a,b){this.H=a;this.ea=b}function ma(a,b){this.fc=0;this.ca=a;this.F=b;this.za=p.Ed?swfobject.za:function(){alert("ERROR: swfobject not loaded!")};this.qc=J()}function M(a,b,c,d){this.view=a;this.Hd=c;this.Wa=b;this.Xc=d+"/_attachments";this.value=null;this.d=undefined}function Q(a){this.view=a}function na(a,b){this.view=a;this.exp=b;this.O=a.getAttribute("ng-validate");this.yc=typeof a.attributes["ng-required"]!="undefined";this.Ja=null;this.d=undefined;this.p=a.value;a.getAttribute("ng-widget")=== +"datepicker"&&k(a).pd()}function oa(a,b){this.view=a;this.exp=b;this.d=undefined;this.p=a.checked?a.value:""}function pa(a,b){this.view=a;this.exp=b;this.d=undefined;this.p=a.value}function qa(a,b){this.view=a;this.exp=b;this.d=undefined;this.p=this.selected()}function ra(a,b){this.view=a;this.exp=b;this.d=this.ia=undefined;this.Ia=a.value;this.p=a.checked?a.value:null}function N(a,b){this.view=a;this.exp=x.Z(b);this.w=false;this.Ac={element:a}}function sa(a,b){this.view=a;this.tb=b}function ta(a, +b){this.view=a;this.exp=b;this.w=false}function ua(a,b){this.view=a;this.exp=b}function va(a,b){this.view=a;this.exp=b}function wa(a,b){this.view=a;this.exp=b}function xa(a,b){this.view=a;this.exp=b}function ya(a,b){this.view=a;this.exp=b}function za(a,b){this.view=a;this.exp=b}function Aa(a,b,c,d){this.view=a;this.template=c;this.prefix=d;this.children=[];a=b.match(/^\s*(.+)\s+in\s+(.*)\s*$/);if(!a)throw"Expected ng-repeat in form of 'item in collection' but got '"+b+"'.";b=a[1];this.X=a[2];a=b.match(/^([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\)$/); +if(!a)throw"'item' in 'item in collection' should be identifier or (key, value) but get '"+b+"'.";this.Jc=a[3]||a[1];this.Yb=a[2]}function B(a){this.B=a}function U(a){this.Ma=a.append(U.hb).find("#ng-loading");this.ba=0}var ba={u:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",Kb:function(a){var b="",c,d,e,f,g,h,i=0;for(a=ba.ob(a);i>2;c=(c&3)<<4|d>>4;g=(d&15)<<2|e>>6;h=e&63;if(isNaN(d))g=h=64;else if(isNaN(e))h= +64;b=b+this.u.charAt(f)+this.u.charAt(c)+this.u.charAt(g)+this.u.charAt(h)}return b},qd:function(a){var b="",c,d,e,f,g,h=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");h>4;d=(d&15)<<4|f>>2;e=(f&3)<<6|g;b+=String.fromCharCode(c);if(f!=64)b+=String.fromCharCode(d);if(g!=64)b+=String.fromCharCode(e)}return b=ba.nb(b)},ob:function(a){a=a.replace(/\r\n/g,"\n"); for(var b="",c=0;c127&&d<2048)b+=String.fromCharCode(d>>6|192);else{b+=String.fromCharCode(d>>12|224);b+=String.fromCharCode(d>>6&63|128)}b+=String.fromCharCode(d&63|128)}}return b},nb:function(a){for(var b="",c=0,d=c1=c2=0;c191&&d<224){c2=a.charCodeAt(c+1);b+=String.fromCharCode((d&31)<<6|c2&63);c+=2}else{c2=a.charCodeAt(c+1);c3=a.charCodeAt(c+ -2);b+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63);c+=3}}return b}};if(typeof z.getAttribute=="undefined")z.getAttribute=J();if(typeof Node=="undefined")Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};p.console||(p.console={log:n,error:n});var R,q=_.each,S=_.extend,k=p.jQuery,X=k.browser.msie,m=p.angular||(p.angular= -{}),Ba=m.validator||(m.validator={}),s=m.filter||(m.filter={}),ca=m.callbacks||(m.callbacks={});m.alert||(m.alert=function(){r(arguments);p.alert.apply(p,arguments)});ha.prototype={load:function(){this.Cb();r("Server: "+this.j.H);this.Bb();this.Ab();this.wb()},Bb:function(){r("Loader.configureJQueryPlugins()");k.fn.scope=function(){for(var a=this;a&&a.get(0);){var b=a.data("scope");if(b)return b;a=a.parent()}return null};k.fn.controller=function(){return this.data("controller")||Q.Vb}},Fc:function(){return""+ -(new Date).getTime()},Ab:function(){var a=this.j;if(!a.F){var b=a.H.match(/https?:\/\/([\w]*)/);a.F=b?b[1]:"$MEMORY"}},wb:function(){function a(){g.Pb(function(l){!l&&c.find("[ng-auth=eager]").length&&g.ja()})}r("Loader.bindHtml()");var b=new ia(this.location),c=this.document,d=new ma(this.j.H,this.j.F),e=new y(c[0],d,b,this.j);d.rc=Ea(e,e.e);b=new P(c.find("body"),this.j.H);var f=this.j.F=="$MEMORY"?new aa(this.window):new ja(this.j.H,k.getScript);f=new ka(f,new U(k(c.body)),function(){e.d()});var g= -new la(f,b),h="/data/"+this.j.F,i=new T(function(l,o){f.N("POST",h,l,o)},g,e.anchor);e.Za.push(function(){i.Ea()});var j=new w({$anchor:e.anchor,$binder:e,$config:this.j,$console:p.console,$datastore:i,$save:function(l){i.Ac(j.q,l,e.anchor)},$window:p,$uid:this.Fc,$users:g},"ROOT");c.data("scope",j);r("$binder.entity()");e.K(j);r("$binder.compile()");e.compile();r("ControlBar.bind()");b.bind();r("$users.fetchCurrentUser()");a();r("PopUp.bind()");(new B(c)).bind();r("$binder.parseAnchor()");e.tc(); -r("$binder.executeInit()");e.Ob();r("$binder.updateView()");e.d();c.find("body").show();r("ready()")},Cb:function(){var a=p.location.href+"#";a=a.split("#")[1];var b={Ib:null};a=a.split("&");for(var c=0;c=0&&a.splice(c,1);return b},find:function(a,b,c){if(b){var d=m.Function.compile(b);_.detect(a,function(e){if(d(e)){c=e;return true}});return c}},findById:function(a,b){return m.Uc.find(a,function(c){return c.z==b},null)},filter:function(a,b){var c=[];c.xb=function(j){for(var l=0;l-1;case "object":for(var o in j)if(o.charAt(0)!=="$"&&e(j[o],l))return true;return false;case "array":for(o=0;o=0&&a.splice(d,1);a.unshift((c?"-":"+")+b);return a},orderByDirection:function(a,b,c,d){c=c||"ng-ascend";d=d||"ng-descend";a=a[0]||"";var e=true;if(a.charAt(0)=="-"){a=a.substring(1);e=false}else if(a.charAt(0)=="+")a=a.substring(1);return a==b?e?c:d:""},merge:function(a,b,c){var d=a[b];if(!d){d={};a[b]=d}Z(c,d);return a}},Ga={quote:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\f/g, -"\\f").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v")+'"'},quoteUnicode:function(a){a=m.String.quote(a);for(var b=[],c=0;c-1;){c1||y.J(a[0])!==null};y.J=function(a){return(a=a.replace(/\n/gm," ").match(/^\{\{(.*)\}\}$/))?a[1]:null};y.prototype={uc:function(a){var b={};a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(c,d,e){if(d)b[decodeURIComponent(d)]=decodeURIComponent(e)});return b},tc:function(a){var b=this;a=a||this.$a.Ga();var c=a.indexOf("#"); -if(!(c<0)){a=this.uc(a.substring(c+1));q(b.anchor,function(d,e){delete b.anchor[e]});q(a,function(d,e){b.anchor[e]=d})}},Gc:function(){var a=this.$a.Ga(),b=a.indexOf("#");if(b>-1)a=a.substring(0,b);a+="#";b="";for(var c in this.anchor){var d=this.anchor[c];if(typeof d==="undefined"||d===null)delete this.anchor[c];else{a+=b+encodeURIComponent(c);if(d!==true)a+="="+encodeURIComponent(d);b="&"}}return a},d:function(){(new Date).getTime();var a=k(this.B).scope();a.i("$invalidWidgets",[]);a.d();(new Date).getTime(); -this.Gc();_.each(this.Za,function(b){b()})},U:function(a){var b=k(this.B),c=b.find(a);if(b.is(a))c=c.andSelf();return c},Ob:function(){this.U("[ng-init]").each(function(){var a=k(this),b=a.scope();try{b.eval(a.attr("ng-init"))}catch(c){alert("EVAL ERROR:\n"+a.attr("ng-init")+"\n"+x(c,true))}})},K:function(a){this.U("[ng-entity]").attr("ng-watch",function(){try{var b=k(this);return a.K(b.attr("ng-entity"))+(b.attr("ng-watch")||"")}catch(c){alert(c)}})},compile:function(){var a=k(this.B),b=this;if(this.j.Zc){var c= -this.U(":submit").not("[ng-action]");c.attr("ng-action","$save()");c.not(":disabled").not("ng-bind-attr").attr("ng-bind-attr",'{disabled:"{{$invalidWidgets}}"}')}this.Sa(this.B)(this.B,a.scope(),"");this.U("a[ng-action]").live("click",function(){var d=k(this);try{d.scope().eval(d.attr("ng-action"));d.removeAttr("ng-error");d.removeClass("ng-exception")}catch(e){d.addClass("ng-exception");d.attr("ng-error",x(e,true))}b.d();return false})},Ec:function(a,b,c){b=b.concat();var d=b.pop(),e=y.$(a.nodeValue); -if(e.length>1||y.J(e[0])){var f=a.parentNode;if(ea(f)){f.setAttribute("ng-bind-template",a.nodeValue);c.push({path:b,b:function(l){return new N(l,l.getAttribute("ng-bind-template"))}})}else for(var g=0;g2&&a.setAttribute("ng-bind-attr",d)}a.getAttribute||r(a);var j=a.getAttribute("ng-repeat");if(j){a.removeAttribute("ng-repeat");var l=this.Sa(a);d=z.createComment("ng-repeat: "+j);e=a.parentNode;e.insertBefore(d,a);e.removeChild(a);function o(t,u,A){var I=k(a).clone();I.css("display","");I.attr("ng-repeat-index",""+A);I.data("scope",t);l(I[0],t,u+A+":");return I}c.push({path:b, -b:function(t,u,A){return new Aa(k(t),j,o,A)}})}else{a.getAttribute("ng-eval")&&c.push({path:b,b:this.lc});a.getAttribute("ng-bind")&&c.push({path:b,b:this.Qa});a.getAttribute("ng-bind-attr")&&c.push({path:b,b:this.hc});a.getAttribute("ng-hide")&&c.push({path:b,b:this.mc});a.getAttribute("ng-show")&&c.push({path:b,b:this.nc});a.getAttribute("ng-class")&&c.push({path:b,b:this.ic});a.getAttribute("ng-class-odd")&&c.push({path:b,b:this.kc});a.getAttribute("ng-class-even")&&c.push({path:b,b:this.jc}); -a.getAttribute("ng-style")&&c.push({path:b,b:this.oc});a.getAttribute("ng-watch")&&c.push({path:b,b:this.pc});d=a.nodeName;if(d=="INPUT"||d=="TEXTAREA"||d=="SELECT"||d=="BUTTON"){var C=this;c.push({path:b,b:function(t,u,A){t.name=A+t.name.split(":").pop();return C.Mc.Db(k(t),u)}})}if(d=="OPTION")if(!k("')};M.prototype={e:function(a){var b=this.view.find("input").attr("checked")?this.value:null;if(this.c===b)return false;else{a.i(this.Wa,b);return true}},d:function(a){if((a=a.get(this.Wa))&&this.value!==a){this.value=a;this.view.find("a").attr("href",this.value.url).text(this.value.text); -this.view.find("span").text(m.filter.bytes(this.value.size))}this.view.find("input").attr("checked",!!a)}};Q.prototype={e:K(true),d:n};Q.Vb=new Q;var Ja=Q;na.prototype={e:function(a){var b=this.view.value;if(this.c===b)return false;else{a.m(this.exp,b);this.c=b;return true}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.p;a.m(this.exp,c)}c=c?c:"";if(this.c!=c)this.c=b.value=c;var d=false;b.removeAttribute("ng-error");if(this.zc)d=!(c&&c.length>0);var e=d?"Required Value": -null;if(!d&&this.O&&c){e=a.Jc(this.O,c);d=!!e}if(this.Ja!==e){this.Ja=d;if(e!==null){b.setAttribute("ng-error",e);a.dc(this)}k(b).toggleClass("ng-validation-error",d)}}};oa.prototype={e:function(a){var b=this.view;b=b.checked?b.value:"";if(this.c===b)return false;else{a.m(this.exp,b);this.c=b;return true}},d:function(a){var b=this.view,c=a.eval(this.exp);if(typeof c==="undefined"){c=this.p;a.m(this.exp,c)}b.checked=b.value==""+c}};pa.prototype={e:function(a){if(this.view.selectedIndex<0)a.m(this.exp, -null);else{var b=this.view.value;if(this.c===b)return false;else{a.m(this.exp,b);this.c=b;return true}}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.p;a.m(this.exp,c)}if(c!==this.c){b.value=c?c:"";this.c=c}}};qa.prototype={selected:function(){for(var a=[],b=this.view.options,c=0;cd;--b){var o=this.children.pop().element[0];o.parentNode.removeChild(o)}if(h&&h.element[0].nodeName==="OPTION")if(d=k(h.element[0].parentNode).data("controller")){d.c=undefined;d.d(a)}})}};B.ua="mouseleave mouseout click dblclick keypress keyup";B.sc=function(){B.ma();var a=k(this);a.bind(B.ua,B.ma);var b=a.position(),c=z.documentElement,d=(self.innerWidth||c&&c.clientWidth|| -z.body.clientWidth)-b.left;c=a.hasClass("ng-exception")?"EXCEPTION:":"Validation error...";a=a.attr("ng-error");d=d>375?"left":"right";c=k("
"+c+"
"+a+"
");k("body").append(c);if(d==="left")a=b.left+this.offsetWidth+11;else{a=b.left-315;c.find(".ng-arrow-right").css({left:301})}c.css({left:a+"px",top:b.top-3+"px"});return true};B.ma=function(){k("#ng-callout").unbind(B.ua, -B.ma).remove();return true};B.prototype={bind:function(){this.B.find(".ng-validation-error,.ng-exception").live("mouseover",B.sc)}};U.hb='
loading....
';U.prototype={vb:function(){this.ca===0&&this.Ma.show();this.ca++},Lb:function(){this.ca--;this.ca===0&&this.Ma.hide("fold")}}})(window,document); +2);b+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63);c+=3}}return b}};if(typeof y.getAttribute=="undefined")y.getAttribute=J();if(typeof Node=="undefined")Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};p.console||(p.console={log:n,error:n});var R,q=_.each,S=_.extend,k=p.jQuery,X=k.browser.msie,m=p.angular||(p.angular= +{}),Ba=m.validator||(m.validator={}),r=m.filter||(m.filter={}),ca=m.callbacks||(m.callbacks={});m.alert||(m.alert=function(){v(arguments);p.alert.apply(p,arguments)});ha.prototype={load:function(){this.Cb();v("Server: "+this.j.H);this.Bb();this.Ab();this.wb()},Bb:function(){v("Loader.configureJQueryPlugins()");k.fn.scope=function(){for(var a=this;a&&a.get(0);){var b=a.data("scope");if(b)return b;a=a.parent()}return null};k.fn.controller=function(){return this.data("controller")||Q.Ub}},Ec:function(){return""+ +(new Date).getTime()},Ab:function(){var a=this.j;if(!a.F){var b=a.H.match(/https?:\/\/([\w]*)/);a.F=b?b[1]:"$MEMORY"}},wb:function(){function a(){g.Ob(function(l){!l&&c.find("[ng-auth=eager]").length&&g.ja()})}v("Loader.bindHtml()");var b=new ia(this.location),c=this.document,d=new ma(this.j.H,this.j.F),e=new x(c[0],d,b,this.j);d.qc=Ea(e,e.e);b=new P(c.find("body"),this.j.H);var f=this.j.F=="$MEMORY"?new aa(this.window):new ja(this.j.H,k.getScript);f=new ka(f,new U(k(c.body)),function(){e.c()});var g= +new la(f,b),h="/data/"+this.j.F,i=new T(function(l,o){f.N("POST",h,l,o)},g,e.anchor);e.Za.push(function(){i.Ea()});var j=new w({$anchor:e.anchor,$binder:e,$config:this.j,$console:p.console,$datastore:i,$save:function(l){i.zc(j.q,l,e.anchor)},$window:p,$uid:this.Ec,$users:g},"ROOT");c.data("scope",j);v("$binder.entity()");e.K(j);v("$binder.compile()");e.compile();v("ControlBar.bind()");b.bind();v("$users.fetchCurrentUser()");a();v("PopUp.bind()");(new B(c)).bind();v("$binder.parseAnchor()");e.sc(); +v("$binder.updateView()");e.c();c.find("body").show();v("ready()")},Cb:function(){var a=p.location.href+"#";a=a.split("#")[1];var b={Ib:null};a=a.split("&");for(var c=0;c=0&&a.splice(c,1);return b},find:function(a,b,c){if(b){var d=m.Function.compile(b);_.detect(a,function(e){if(d(e)){c=e;return true}});return c}},findById:function(a,b){return m.Tc.find(a,function(c){return c.z==b},null)},filter:function(a,b){var c=[];c.xb=function(j){for(var l=0;l-1;case "object":for(var o in j)if(o.charAt(0)!=="$"&&e(j[o],l))return true;return false;case "array":for(o=0;o=0&&a.splice(d,1);a.unshift((c?"-":"+")+b);return a},orderByDirection:function(a,b,c,d){c=c||"ng-ascend";d=d||"ng-descend";a=a[0]||"";var e=true;if(a.charAt(0)=="-"){a=a.substring(1);e=false}else if(a.charAt(0)=="+")a=a.substring(1);return a==b?e?c:d:""},merge:function(a,b,c){var d=a[b];if(!d){d={};a[b]=d}Z(c,d);return a}},Ga={quote:function(a){return'"'+ +a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v")+'"'},quoteUnicode:function(a){a=m.String.quote(a);for(var b=[],c=0;c-1;){c1||x.J(a[0])!==null};x.J=function(a){return(a=a.replace(/\n/gm," ").match(/^\{\{(.*)\}\}$/))?a[1]:null};x.prototype={tc:function(a){var b={};a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(c,d,e){if(d)b[decodeURIComponent(d)]=decodeURIComponent(e)});return b},sc:function(a){var b= +this;a=a||this.$a.Ga();var c=a.indexOf("#");if(!(c<0)){a=this.tc(a.substring(c+1));q(b.anchor,function(d,e){delete b.anchor[e]});q(a,function(d,e){b.anchor[e]=d})}},Fc:function(){var a=this.$a.Ga(),b=a.indexOf("#");if(b>-1)a=a.substring(0,b);a+="#";b="";for(var c in this.anchor){var d=this.anchor[c];if(typeof d==="undefined"||d===null)delete this.anchor[c];else{a+=b+encodeURIComponent(c);if(d!==true)a+="="+encodeURIComponent(d);b="&"}}return a},c:function(){(new Date).getTime();var a=k(this.B).scope(); +a.i("$invalidWidgets",[]);a.c();(new Date).getTime();this.Fc();_.each(this.Za,function(b){b()})},ga:function(a){var b=k(this.B),c=b.find(a);if(b.is(a))c=c.andSelf();return c},K:function(a){this.ga("[ng-entity]").attr("ng-watch",function(){try{var b=k(this);return a.K(b.attr("ng-entity"))+(b.attr("ng-watch")||"")}catch(c){alert(c)}})},compile:function(){var a=k(this.B),b=this;if(this.j.Yc){var c=this.ga(":submit").not("[ng-action]");c.attr("ng-action","$save()");c.not(":disabled").not("ng-bind-attr").attr("ng-bind-attr", +'{disabled:"{{$invalidWidgets}}"}')}this.Sa(this.B)(this.B,a.scope(),"");this.ga("a[ng-action]").live("click",function(){var d=k(this);try{d.scope().eval(d.attr("ng-action"));d.removeAttr("ng-error");d.removeClass("ng-exception")}catch(e){d.addClass("ng-exception");d.attr("ng-error",z(e,true))}b.c();return false})},Dc:function(a,b,c){b=b.concat();var d=b.pop(),e=x.Z(a.nodeValue);if(e.length>1||x.J(e[0])){var f=a.parentNode;if(ea(f)){f.setAttribute("ng-bind-template",a.nodeValue);c.push({path:b,b:function(l){return new N(l, +l.getAttribute("ng-bind-template"))}})}else for(var g=0;g2&&a.setAttribute("ng-bind-attr", +d)}a.getAttribute||v(a);var j=a.getAttribute("ng-repeat");if(j){a.removeAttribute("ng-repeat");var l=this.Sa(a);d=y.createComment("ng-repeat: "+j);e=a.parentNode;e.insertBefore(d,a);e.removeChild(a);function o(s,t,A){var I=k(a).clone();I.css("display","");I.attr("ng-repeat-index",""+A);I.data("scope",s);l(I[0],s,t+A+":");return I}c.push({path:b,b:function(s,t,A){return new Aa(k(s),j,o,A)}})}else{a.getAttribute("ng-eval")&&c.push({path:b,b:this.kc});a.getAttribute("ng-bind")&&c.push({path:b,b:this.Qa}); +a.getAttribute("ng-bind-attr")&&c.push({path:b,b:this.gc});a.getAttribute("ng-hide")&&c.push({path:b,b:this.lc});a.getAttribute("ng-show")&&c.push({path:b,b:this.mc});a.getAttribute("ng-class")&&c.push({path:b,b:this.hc});a.getAttribute("ng-class-odd")&&c.push({path:b,b:this.jc});a.getAttribute("ng-class-even")&&c.push({path:b,b:this.ic});a.getAttribute("ng-style")&&c.push({path:b,b:this.nc});a.getAttribute("ng-watch")&&c.push({path:b,b:this.oc});d=a.nodeName;if(d=="INPUT"||d=="TEXTAREA"||d=="SELECT"|| +d=="BUTTON"){var C=this;c.push({path:b,b:function(s,t,A){s.name=A+s.name.split(":").pop();return C.Lc.Db(k(s),t)}})}if(d=="OPTION")if(!k("')};M.prototype={e:function(a){var b=this.view.find("input").attr("checked")? +this.value:null;if(this.d===b)return false;else{a.i(this.Wa,b);return true}},c:function(a){if((a=a.get(this.Wa))&&this.value!==a){this.value=a;this.view.find("a").attr("href",this.value.url).text(this.value.text);this.view.find("span").text(m.filter.bytes(this.value.size))}this.view.find("input").attr("checked",!!a)}};Q.prototype={e:K(true),c:n};Q.Ub=new Q;var Ja=Q;na.prototype={e:function(a){var b=this.view.value;if(this.d===b)return false;else{a.m(this.exp,b);this.d=b;return true}},c:function(a){var b= +this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.p;a.m(this.exp,c)}c=c?c:"";if(this.d!=c)this.d=b.value=c;var d=false;b.removeAttribute("ng-error");if(this.yc)d=!(c&&c.length>0);var e=d?"Required Value":null;if(!d&&this.O&&c){e=a.Ic(this.O,c);d=!!e}if(this.Ja!==e){this.Ja=d;if(e!==null){b.setAttribute("ng-error",e);a.cc(this)}k(b).toggleClass("ng-validation-error",d)}}};oa.prototype={e:function(a){var b=this.view;b=b.checked?b.value:"";if(this.d===b)return false;else{a.m(this.exp,b); +this.d=b;return true}},c:function(a){var b=this.view,c=a.eval(this.exp);if(typeof c==="undefined"){c=this.p;a.m(this.exp,c)}b.checked=b.value==""+c}};pa.prototype={e:function(a){if(this.view.selectedIndex<0)a.m(this.exp,null);else{var b=this.view.value;if(this.d===b)return false;else{a.m(this.exp,b);this.d=b;return true}}},c:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.p;a.m(this.exp,c)}if(c!==this.d){b.value=c?c:"";this.d=c}}};qa.prototype={selected:function(){for(var a= +[],b=this.view.options,c=0;cd;--b){var o=this.children.pop().element[0];o.parentNode.removeChild(o)}if(h&&h.element[0].nodeName==="OPTION")if(d=k(h.element[0].parentNode).data("controller")){d.d= +undefined;d.c(a)}})}};B.ua="mouseleave mouseout click dblclick keypress keyup";B.rc=function(){B.ma();var a=k(this);a.bind(B.ua,B.ma);var b=a.position(),c=y.documentElement,d=(self.innerWidth||c&&c.clientWidth||y.body.clientWidth)-b.left;c=a.hasClass("ng-exception")?"EXCEPTION:":"Validation error...";a=a.attr("ng-error");d=d>375?"left":"right";c=k("
"+c+"
"+a+"
");k("body").append(c); +if(d==="left")a=b.left+this.offsetWidth+11;else{a=b.left-315;c.find(".ng-arrow-right").css({left:301})}c.css({left:a+"px",top:b.top-3+"px"});return true};B.ma=function(){k("#ng-callout").unbind(B.ua,B.ma).remove();return true};B.prototype={bind:function(){this.B.find(".ng-validation-error,.ng-exception").live("mouseover",B.rc)}};U.hb='
loading....
';U.prototype={vb:function(){this.ba===0&&this.Ma.show();this.ba++},Lb:function(){this.ba--;this.ba=== +0&&this.Ma.hide("fold")}}})(window,document); diff --git a/angular.js b/angular.js index a9c7eb6f..e3f24ecb 100644 --- a/angular.js +++ b/angular.js @@ -449,10 +449,7 @@ Loader.prototype = { log('$binder.parseAnchor()'); binder.parseAnchor(); - - log('$binder.executeInit()'); - binder.executeInit(); - + log('$binder.updateView()'); binder.updateView(); @@ -584,9 +581,10 @@ angular['compile'] = function(root, config) { var scope = jQuery(root).scope(); //TODO: cleanup return { - 'updateView':function(){return scope.updateView.apply(scope, arguments);}, + 'updateView':function(){return scope.updateView();}, 'set':function(){return scope.set.apply(scope, arguments);}, - 'get':function(){return scope.get.apply(scope, arguments);} + 'get':function(){return scope.get.apply(scope, arguments);}, + 'init':function(){scope.get('$binder.executeInit')(); scope.updateView();} }; };var angularGlobal = { 'typeOf':function(obj){ diff --git a/src/Loader.js b/src/Loader.js index 2ce44f48..f3c765cd 100644 --- a/src/Loader.js +++ b/src/Loader.js @@ -284,10 +284,7 @@ Loader.prototype = { log('$binder.parseAnchor()'); binder.parseAnchor(); - - log('$binder.executeInit()'); - binder.executeInit(); - + log('$binder.updateView()'); binder.updateView(); @@ -419,8 +416,9 @@ angular['compile'] = function(root, config) { var scope = jQuery(root).scope(); //TODO: cleanup return { - 'updateView':function(){return scope.updateView.apply(scope, arguments);}, + 'updateView':function(){return scope.updateView();}, 'set':function(){return scope.set.apply(scope, arguments);}, - 'get':function(){return scope.get.apply(scope, arguments);} + 'get':function(){return scope.get.apply(scope, arguments);}, + 'init':function(){scope.get('$binder.executeInit')(); scope.updateView();} }; }; \ No newline at end of file diff --git a/test/ExternalApiTest.js b/test/ExternalApiTest.js index 7356915b..cc102ae0 100644 --- a/test/ExternalApiTest.js +++ b/test/ExternalApiTest.js @@ -4,6 +4,7 @@ ExternalApiTest.prototype = { testItShouldExposefactory:function(){ var node = $('
{{b=a+1}}
')[0]; var scope = angular.compile(node); + scope.init(); assertEquals(1, scope.get('a')); assertEquals(2, scope.get('b')); }, -- cgit v1.2.3