What the Heck is Shadow DOM?
glazkov.com
glazkov.com
However, when it comes to encapsulation by enforcing information hiding it sounds awfully lot like trying to protect random dumbfools from themselves. It certainly ought to be sufficient to define the public interface in the documentation or headers, and expect people to adhere to that.
A smart programmer really can find his way through into what was in the first place encapsulated if he really, really has to. Conversely, in the case where a dumbfool would ignore the documentation and poke around with private code he would simply do equally stupid but alternative things if he was prevented from touching any private parts (Hehe). That is, if one can't do the job he can't do the job no matter how severely his options are limited.
The ability to limit the scope of a script tag would be desired too. Something like:
<script> var notsoglobalobject = {}; </script> <script global-object="notsoglobalobject" src="yourevilscript.js"></script>
But stuff like these are both hard to design and hard to make real standards.
I think he would have some great suggestions. :)
For details on behaviors see http://msdn.microsoft.com/en-us/library/ms531079(v=vs.85).as....
IE team did some great trailblazing work back in the day! :)
Keep in mind that at the time it was all based on the Trident rendering engine introduced in IE4. The system requirements at the time were Win95 and 16MB of RAM. You write different code for that vs. a modern desktop today.
function foo() {
var x = 0;
return function () { return x++; }
}
and the equivalent in Python/Ruby/any language with closures hides x even better than a private member in Java would.