really rough outline for an import inliner
4 files changed
tree: e5fff2a91bc185b1f45a0c677eca181175869daa
  1. .gitignore
  2. .status
  3. AUTHORS
  4. CHANGELOG.md
  5. CONTRIBUTING.md
  6. LICENSE
  7. PATENTS
  8. README.md
  9. codereview.settings
  10. lib/
  11. pubspec.yaml
  12. test/
README.md

Web Components

NOTE: This repo is currently inactive

This repo is a copy of the web_components package. This copy is not currently in active use. The code is still being developed in the main Dart repo under branches/bleeding_edge/dart/pkg/web_components/. We are in the process of moving the code here, but you may find the sources here to be stale. Pull requests will not be merged here until the migration is complete.

END NOTE

This package has the polyfills for Shadow DOM, Custom Elements, and HTML Imports.

These features exist in dart:html, for example Element.reateShadowRoot and Document.register. However those APIs are not supported on all browsers yet unless you load the polyfills, as indicated below.

Getting started

Include the polyfills in your HTML <head> to enable Shadow DOM:

<script src="packages/web_components/platform.js"></script>
<script src="packages/web_components/dart_support.js"></script>

You can also use an unminified version for development:

<script src="packages/web_components/platform.concat.js"></script>
<script src="packages/web_components/dart_support.js"></script>

Because the Shadow DOM polyfill does extensive DOM patching, platform.js should be included before other script tags. Be sure to include dart_support.js too, it is required for the Shadow DOM polyfill to work with dart2js.

Custom Elements

Custom Elements let authors define their own elements. Authors associate JavaScript or Dart code with custom tag names, and then use those custom tag names as they would any standard tag.

For example, after registering a special kind of button called super-button, use the super button just like this:

<super-button></super-button>

Custom elements are still elements. We can create, use, manipulate, and compose them just as easily as any standard <div> or <span> today.

See the Polymer Custom Elements page for more information.

Shadow DOM

Shadow DOM is designed to provide encapsulation by hiding DOM subtrees under shadow roots. It provides a method of establishing and maintaining functional boundaries between DOM trees and how these trees interact with each other within a document, thus enabling better functional encapsulation within the DOM.

See the Polymer Shadow DOM page for more information.

Hacking on this package

To rebuild platform.js:

# Make a directory like ~/src/polymer
mkdir ~/src/polymer
cd ~/src/polymer
git clone https://github.com/polymer/tools

# Sync polymer repositories
./tools/bin/pull-all-polymer.sh

# If you don't have "npm", get it here: http://nodejs.org
cd platform-dev
npm install
grunt minify audit
cd build

# Copy the build output to your Dart source tree
cp build.log platform* ~/dart/dart/pkg/web_components/lib