javascript - Why is Chrome Dev Tools inspector showing different values than in code? -


a picture worth thousand words. maybe i'm tired don't know, has me stuck reason , makes no sense ever. can point me in right direction?

chrome dev tools

ie dev tools

> right click images , open in new tab

stand alone code

/**  * @file maestro.class.js  *  * @external $m         main maestro object  * @external $m.core    maestro core object  */  /**  * modified version of class.js cater static inheritance , deep   * object cloning. based on class.js (javascript mvc --   * justin meyer, brian moschel, michael mayer , others)  * (http://javascriptmvc.com/contribute.html)  *  * - portions adapted prototype javascript framework, version 1.6.0.1 (c) 2005-2007 sam stephenson  * - portions extracted jquery 1.7  * - string utilities methods removed , added string prototype. documentation  * added , making code closure compiler advanced safe andrew donelson.  *  * class system javascript  *  * setup method called prior init -- nice if want things without needing  * users call _super in init, normalizing parameters.  *  * @class class  * @expose  * @namespace class  * @memberof core  * advanced optimization compliant  */ (function (m$) {     var          /**           * have dropped code production, it's bothering why          * happening , figured out.          *          * @property {object} regs          * @expose           */         regs = {             'undhash':/_|-/,             'colons':/::/,             'words':/([a-z]+)([a-z][a-z])/g,             'lowup':/([a-z\d])([a-z])/g,             'dash':/([a-z\d])([a-z])/g,             'replacer':/\{([^\}]+)\}/g,             'dot':/\./         },          /**          * @method getnext          * @expose          * @param {*} current          * @param {string} nextpart          * @param {boolean} add          * @returns {*}           */         getnext = function(current, nextpart, add)         {             return current[nextpart] || ( add && (current[nextpart] = {}) );         },          /**          * returns true if given parameter either function or object          *          * @method iscontainer          * @expose          * @param {*} current          * @returns {*}           */         iscontainer=function (current)         {             var type = typeof current;             return type && (  type == 'function' || type == 'object' );         },          /**          * gets object string.          *          * @method getobject          * @expose          * @param {string} name name of object          * @param {array} [roots] array of root objects name          * @param {boolean} [add] true add missing objects          *  path. false remove found properties. undefined          *  not modify root object          * @returns {string}           */         getobject=function (objectname, roots, add)         {             //production version:             //var parts = objectname ? objectname.split(/\./) : [],              var parts = objectname ? objectname.split(regs.dot) : [],                 length = parts.length,                 currents = m$.isarray(roots) ? roots : [roots || window],                 current,                 ret,                 i,                 c = 0,                 type;              if (length == 0)             {                 return currents[0];             }             while (current = currents[c++])             {                 (i = 0; < length - 1 && m$.iscontainer(current); i++)                 {                     current = m$.getnext(current, parts[i], add);                 }                 if (m$.iscontainer(current))                 {                      ret = m$.getnext(current, parts[i], add);                      if (ret !== undefined)                     {                          if (add === false)                         {                             delete current[parts[i]];                         }                         return ret;                     }                  }             }         };      //this trying save names correctly.      //not wanted. , not working anyway.     m$.regs=regs;     m$.getnext = getnext;     m$.iscontainer = iscontainer;     m$.getobject = getobject;     })(m$['core']); 

and minimized closure compiler, advanced optimizations:

//so why did renamed? noot expose used, //but manually accessed objects methods , property. (function(b){ var h={undhash:/_|-/,colons:/::/,words:/([a-z]+)([a-z][a-z])/g,lowup:/([a-z\d])([a-z])/g,dash:/([a-z\d])([a-z])/g,replacer:/\{([^\}]+)\}/g,dot:/\./}; b.e=h; b.a=function(a,b,f){return a[b]||f&&(a[b]={})}; b.b=function(a){return(a=typeof a)&&("function"==a||"object"==a)}; b.d=function(a,d,f){a=a?a.split(h.c):[]; var k=a.length; d=b.isarray(d)?d:[d||window]; var c,g,e,l=0;if(0==k)return d[0]; for(;c=d[l++];){for(e=0;e<k-1&&b.b(c);e++)c=b.a(c,a[e],f); if(b.b(c)&&(g=b.a(c,a[e],f),void 0!==g))return!1===f&&delete c[a[e]],g}} })(m$.core); 

i wish you'd copy pasted complete text somewhere (in pastebin or jsfiddle if not here) because it's harder answer if keep having click on picture, remember saw, click on window , start typing, click on picture remind myself, click on window , continue typing... click on picture sure etc..

anyway, mysterious bit not f changes j or h changes j g changes j , regs changes j.

if @ line below, variables f , h assigned:

a.g = f; 

and point on f no longer used. now, considering this, i'm going assume @ point a.g or a.regs assigned core.j. i'm further going assume non closure compiled code assigning a.regs core.regs closure compiler compiles core.regs core.j , a.regs a.g.

search in remainder of code how values contained in a gets assigned core , you'll have answer.


additional answer:

if want force closure export need make impossible replace names safely. global variables cannot replaced safely because may used js file included in page. such, if want regs preserved make global removing var.

or, make clear a global or core or m$ global depending on needs.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -