OLD | NEW |
1 Sky Markup: Syntax | 1 Sky Markup: Syntax |
2 ================== | 2 ================== |
3 | 3 |
4 A Sky file must consist of the following components: | 4 A Sky file must consist of the following components: |
5 | 5 |
6 1. If the file is intended to be a top-level Sky application, the | 6 1. If the file is intended to be a top-level Sky application, the |
7 string "``#!mojo mojo:sky``" followed by a U+0020, U+000A or | 7 string "``#!mojo mojo:sky``" followed by a U+0020, U+000A or |
8 U+000D character. | 8 U+000D character. |
9 | 9 |
10 If the file is intended to be a module, then the string "SKY", a | 10 If the file is intended to be a module, then the string "SKY", a |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 3. Same sequence of characters as "tag name" above. | 137 3. Same sequence of characters as "tag name" above. |
138 4. ``>`` | 138 4. ``>`` |
139 | 139 |
140 | 140 |
141 Sky Markup: Elements | 141 Sky Markup: Elements |
142 ==================== | 142 ==================== |
143 | 143 |
144 The Sky language consists of very few elements, since it is expected | 144 The Sky language consists of very few elements, since it is expected |
145 that everything of note would be provided by frameworks. | 145 that everything of note would be provided by frameworks. |
146 | 146 |
| 147 The following elements are implicitly registered by default, even if |
| 148 you haven't imported anything. You can get to their constructors if |
| 149 you import sky:core (basically, sky:core is always imported by defaul; |
| 150 it's the runtime library). None of these elements have shadow trees. |
| 151 |
147 ``<import src="foo.sky">`` | 152 ``<import src="foo.sky">`` |
148 - Downloads and imports foo.sky in the background. | 153 - Downloads and imports foo.sky in the background. |
149 | 154 |
150 ``<import src="foo.sky" as="foo">`` | 155 ``<import src="foo.sky" as="foo">`` |
151 - Downloads and imports foo.sky in the background, using "foo" as its | 156 - Downloads and imports foo.sky in the background, using "foo" as its |
152 local name (see ``<script>``). | 157 local name (see ``<script>``). |
153 | 158 |
154 ``<template>`` | 159 ``<template>`` |
155 - The contents of the element aren't placed in the Element itself. | 160 - The contents of the element aren't placed in the Element itself. |
156 They are instead placed into a DocumentFragment that you can obtain | 161 They are instead placed into a DocumentFragment that you can obtain |
(...skipping 12 matching lines...) Expand all Loading... |
169 ``<content>`` | 174 ``<content>`` |
170 ``<content select="...">`` | 175 ``<content select="...">`` |
171 - In a shadow tree, acts as an insertion point for distributed nodes. | 176 - In a shadow tree, acts as an insertion point for distributed nodes. |
172 The select="" attribute gives the selector to use to pick the nodes | 177 The select="" attribute gives the selector to use to pick the nodes |
173 to place in this insertion point; it defaults to everything. | 178 to place in this insertion point; it defaults to everything. |
174 | 179 |
175 ``<img src="foo.bin">`` | 180 ``<img src="foo.bin">`` |
176 - Sky fetches the bits for foo.bin, looks for a decoder for those | 181 - Sky fetches the bits for foo.bin, looks for a decoder for those |
177 bits, and renders the bits that the decoder returns. | 182 bits, and renders the bits that the decoder returns. |
178 | 183 |
| 184 ``<div>`` |
| 185 - Element that does nothing. |
| 186 |
| 187 ``<span>`` |
| 188 - Element that does nothing. |
| 189 |
179 ``<iframe src="foo.bin">`` | 190 ``<iframe src="foo.bin">`` |
180 - Sky tells mojo to open an application for foo.bin, and hands that | 191 - Sky tells mojo to open an application for foo.bin, and hands that |
181 application a view so that the application can render appropriately. | 192 application a view so that the application can render appropriately. |
182 | 193 |
183 ``<t>`` | 194 ``<t>`` |
184 - Within a ``<t>`` section, whitespace is not trimmed from the start and | 195 - Within a ``<t>`` section, whitespace is not trimmed from the start and |
185 end of text nodes by the parser. | 196 end of text nodes by the parser. |
186 TOOD(ianh): figure out if the authoring aesthetics of this are ok | 197 TOOD(ianh): figure out if the authoring aesthetics of this are ok |
187 | 198 |
188 ``<a href="foo.bin">`` | 199 ``<a href="foo.bin">`` |
189 - A widget that, when invoked, causes mojo to open a new application | 200 - A widget that, when invoked, causes mojo to open a new application |
190 for "foo.bin". | 201 for "foo.bin". |
191 | 202 |
192 ``<title>`` | 203 ``<title>`` |
193 - Sets the contents as the document's title (as provided by Sky to | 204 - Sets the contents as the document's title (as provided by Sky to |
194 the view manager). (Actually just ensures that any time the element | 205 the view manager). (Actually just ensures that any time the element |
195 is mutated, theTitleElement.ownerScope.ownerDocument.title is set | 206 is mutated, theTitleElement.ownerScope.ownerDocument.title is set |
196 to the element's contents.) | 207 to the element's contents.) |
197 | 208 |
| 209 ``<error>`` |
| 210 - Represents a parse error. |
| 211 |
198 | 212 |
199 Sky Markup: Global Attributes | 213 Sky Markup: Global Attributes |
200 ============================= | 214 ============================= |
201 | 215 |
202 The following attributes are available on all elements: | 216 The following attributes are available on all elements: |
203 | 217 |
204 * ``id=""`` (any value) | 218 * ``id=""`` (any value) |
205 * ``class=""`` (any value, space-separated) | 219 * ``class=""`` (any value, space-separated) |
206 * ``style=""`` (declaration part of a Sky style rule) | 220 * ``style=""`` (declaration part of a Sky style rule) |
207 * ``lang=""`` (language code) | 221 * ``lang=""`` (language code) |
208 * ``dir=""`` (ltr or rtl only) | 222 * ``dir=""`` (ltr or rtl only) |
209 * ``contenteditable=""`` (subject to future developments) | 223 * ``contenteditable=""`` (subject to future developments) |
210 * ``tabindex=""`` (subject to future developments) | 224 * ``tabindex=""`` (subject to future developments) |
OLD | NEW |