Hacker News new | ask | show | jobs
by jashkenas 5487 days ago
Usually that's the case -- but if you know for certain that there's a one-to-one relationship between a model and it's view, then there's no harm in having a direct reference for convenience. Pragmatism > Purity, where UI code is concerned.
1 comments

I agree with you. I'm concerned about memory leaks from the circular references, though.
Circular references are garbage collected -- no need to worry about them.

You might be thinking of a terrible old IE bug where circular references between JavaScript objects and DOM nodes were never collected, but that's never been an issue with JavaScript-only references.

Oh, I didn't know that. That alleviates many of my concerns, then, thank you.