#15315 closed defect (fixed)
setting one Stateful as the value of another copies `_watchCallbacks`
Reported by: | ben hockey | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | undecided | Milestone: | 1.8 |
Component: | Core | Version: | 1.7.2 |
Keywords: | Cc: | Kitson Kelly | |
Blocked By: | Blocking: |
Description
when setting one Stateful as the value for another, the watchers of the Stateful being passed are then also effectively watching the Stateful that is being set. the diff below is for tests/Stateful.js to demonstrate the problem
-
tests/Stateful.js
20 20 doh.is(5, s.get("foo")); 21 21 }, 22 22 function setHash(t){ 23 var s = new dojo.Stateful(); 23 var s = new dojo.Stateful(), 24 fooCount = 0, 25 handle = s.watch('foo', function () { 26 fooCount++; 27 }); 24 28 s.set({ 25 29 foo:3, 26 30 bar: 5 27 31 }); 28 32 doh.is(3, s.get("foo")); 29 33 doh.is(5, s.get("bar")); 34 doh.is(1, fooCount); 30 35 var s2 = new dojo.Stateful(); 31 36 s2.set(s); 32 37 doh.is(3, s2.get("foo")); 33 38 doh.is(5, s2.get("bar")); 39 // s watchers should not be copied to s2 40 doh.is(1, fooCount); 41 handle.unwatch(); 34 42 }, 35 43 function wildcard(t){ 36 44 var s = new dojo.Stateful();
i found this while looking at #15187 but since this issue has existed all along i opened it as a new ticket.
Change History (3)
comment:1 Changed 9 years ago by
Cc: | Kitson Kelly added |
---|---|
Owner: | set to Kris Zyp |
Status: | new → assigned |
comment:3 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|
Note: See
TracTickets for help on using
tickets.
Guess this should be assigned to Kris unless Kitson wants to fix it.