Cached object in console?


Answers

Question

I'll start with the problem :

  1. I'm changing the content of an object literal. (changing the properties values)
  2. The Firebug console (at first clicks) shows the correct values.
  3. But after a while, it get stuck on a specific value and stop from changing.

(notice : the stringify representation of the object - Always shows the correct values)

And here are the Details:

  1. I select a street in the textbox (it should set the StreetText value in the object)

  2. I look at the console (wide line) and press the last line , looking at the street text.

At first it's OK. In the second try, after I choose another street, it stays on the old value.

However, when I press refresh (on the object), it shows me the correct street name.

What is going on here?

My object is a regular object literal :

  var obj =
            {
                getData: function ()
                {

                    obj.CountryId = $(".ddlCountry").val() || "";
                    obj.CountryText = $(".ddlCountry  :selected").text() || "";
                    obj.StateId = $(".ddlState:visible").val() || "";
                    obj.StateText = $(".ddlState:visible  :selected").text() || "";
                    obj.CityId = $(".hfDataIdCity").val() || "";
                    obj.CityText = $(".hfDataTextCity").val() || "";
                    obj.StreetId = $(".hfDataIdStreet").val() || "";
                    obj.StreetText = $(".hfDataTextStreet").val() || "";
                }
        }

and the display on the console is made by onclicking the button :

 obj.getData();
 console.log(obj);

Why I'm not seeing the correct values ? ( only after refresh....)

p.s. : ff: 14.0.1
fb:1.10.6

and the cache is turned off





Tags