How to limit access to a javascript object?
<p>I was watching a video on making a good javascript application infrastructure. Basically what it said was:</p>

<ul>
<li>Your application consists of components</li>
<li>Components are parts of the page that can act on their own.</li>
<li>components can be registered into te application.</li>
<li>upon registration, they get their own sandbox.</li>
<li>A sandbox is an component's interface to the application core.</li>
<li>The core is built on top of a javascript library.</li>
<li>Components only have access to their sandbox, not to other components, nore the core or the underlying library.</li>
</ul>

<p>Now, what I'd like to make is an application where you can easily make new components. Components have their own part on tha page, their own div in which they can work. And here comes the first part of my question: I want to give these components a copy of the jQuery object, but that has an internal restriction applied so that it can only work inside a certain containing element.</p>

<p>The second part is,that even if a component has limited access to the DOM using jquery, it can still access the document. I have tried both setting Window and Document to null, before running my test script, but the browser doesn't allow this. Is there any way that I can truly restrict the possibilities of an object to the methods of 1 object that I pass to it?</p>
