Specs: default exports to {} rather than document, since it makes writing modules saner

Review URL: https://codereview.chromium.org/730223002
This commit is contained in:
Hixie 2014-11-17 13:08:09 -08:00
parent 465846c37d
commit 93cca4aed1
4 changed files with 6 additions and 9 deletions

View File

@ -21,7 +21,7 @@ SKY MODULE - defines an <element> element
<script>
module.exports.Element = sky.registerElement({
tagName: 'element',
prototype: class extends Element {
constructor: class extends Element {
constructor (module) {
super();
this.state = 'loading';

View File

@ -1,10 +1,6 @@
SKY MODULE - radio button and radio button group
<!-- accessibility handling not implemented yet, pending mojo service -->
<script>
module.exports = {};
</script>
<!-- <radio> -->
<template id="radio-shadow">
<style>

View File

@ -311,7 +311,7 @@ module 'sky:core' {
constructor (Application application, Document document, String url); // O(1)
readonly attribute Application application; // O(1)
attribute any exports; // O(1) // defaults to the module's document
attribute any exports; // O(1) // defaults to {}
}
class Application : AbstractModule {

View File

@ -35,9 +35,10 @@ the [``Module`` object](apis.md) that represents the module.
A module can export a value by assigning the ``exports`` property of
its ``Module`` object. By default, the ``exports`` property of a
``Module`` is its ``Document`` object, so that a script-less
import is still useful (it exposes its contents, e.g. templates that
the import might have been written to provide).
``Module`` is an empty Object. Properties can be added to the object,
or, it can be set to an entirely different object; for example, it
could be set to the module's Document itself, in case the point of the
module is to expose some ``template`` elements.
### Exporting element definitions ###