Twitter 40

Mozilla has been working on Web Components — a technology encompassing HTML imports, custom elements, and shadow DOM — for a while now and testing this approach in Gaia, the frontend of Firefox OS. Unfortunately, our feedback into the standards process has not always resulted in the changes required for us to ship Web Components. Therefore we decided to reevaluate our stance with members of the developer community.

If you want to include a library in frontend JavaScript, you have to link the library first with a script tag. You can use the library anytime after you link it.

<!-- This is html -->
<script src="link-to-jquery.js"></script>
<script>  // You can use jQuery anytime after you link to it  console.log(jQuery)</script>

This works because JavaScript in browsers shares one global scope. It doesn’t matter how many JavaScript files you link to. They behave as if they’re one big JavaScript file

Link the library first with a script tag. Then you can use the library anytime after you link it.