Annotation of html5/spec-author-view/the-script-element.html, revision 1.141
1.104 mike 1: <!doctype html>
1.141 ! mike 2: <html lang="en-US-x-Hixie" xml:lang="en-US-x-Hixie" xmlns="http://www.w3.org/1999/xhtml"><meta content="text-html; charset=utf-8" http-equiv="Content-Type"><meta content="HTML Tidy for HTML5 (experimental) for Linux/x86 http://github.com/w3c/tidy-html5/tree/c63cc39" name="generator"><title>4.3.1 The script element — HTML5</title><link href="style.css" rel="stylesheet"><style type="text-css">
1.138 mike 3: /**/
4: /**/
1.132 mike 5: pre { margin-left: 2em; white-space: pre-wrap; }
6: h2 { margin: 3em 0 1em 0; }
7: h3 { margin: 2.5em 0 1em 0; }
8: h4 { margin: 2.5em 0 0.75em 0; }
9: h5, h6 { margin: 2.5em 0 1em; }
10: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
11: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
12: p { margin: 1em 0; }
13: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
14: dl, dd { margin-top: 0; margin-bottom: 0; }
15: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
16: dt + dt { margin-top: 0; }
17: dd dt { margin-top: 0.25em; margin-bottom: 0; }
18: dd p { margin-top: 0; }
19: dd dl + p { margin-top: 1em; }
20: dd table + p { margin-top: 1em; }
21: p + * > li, dd li { margin: 1em 0; }
22: dt, dfn { font-weight: bold; font-style: normal; }
23: i, em { font-style: italic; }
24: dt dfn { font-style: italic; }
25: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
26: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
27: pre em { font-weight: bolder; font-style: normal; }
28: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
29: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
30: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
31: table thead, table tbody { border-bottom: solid; }
32: table tbody th:first-child { border-left: solid; }
33: table tbody th { text-align: left; }
34: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
35: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
36:
37: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
38: .matrix, .matrix td { border: none; text-align: right; }
39: .matrix { margin-left: 2em; }
40: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
41: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
42: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
43:
44: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
45: img.extra, p.overview { float: right; }
46: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
47: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
48: pre.idl::before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
49: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
50: pre.css:first-line { color: #AAAA50; }
51: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
52: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
53: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
54: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
55: dl.domintro dd p { margin: 0.5em 0; }
56: dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
57: dl.switch { padding-left: 2em; }
58: dl.switch > dt { text-indent: -1.5em; }
59: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
60: dl.triple { padding: 0 0 0 1em; }
61: dl.triple dt, dl.triple dd { margin: 0; display: inline }
62: dl.triple dt:after { content: ':'; }
63: dl.triple dd:after { content: '\A'; white-space: pre; }
64: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
65: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
66: a .diff-new { border-bottom: 1px blue solid; }
67:
1.138 mike 68: figure.diagrams { border: double black; background: white; padding: 1em; }
69: figure.diagrams img { display: block; margin: 1em auto; }
70:
1.132 mike 71: h2 { page-break-before: always; }
72: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
73: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
74:
75: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
76: li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }
77:
78: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
79: div.head p { margin: 0; }
80: div.head h1 { margin: 0; }
81: div.head .logo { float: right; margin: 0 1em; }
82: div.head .logo img { border: none } /* remove border from top image */
83: div.head dl { margin: 1em 0; }
84: div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
85:
86: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
87: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
88: body > .toc > li > * { margin-bottom: 0.5em; }
89: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
90: .toc, .toc li { list-style: none; }
91:
92: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
93: .brief li { margin: 0; padding: 0; }
94: .brief li p { margin: 0; padding: 0; }
95:
96: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
97: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
98: .category-list li { display: inline; }
99: .category-list li:not(:last-child)::after { content: ', '; }
100: .category-list li > span, .category-list li > a { text-transform: lowercase; }
1.138 mike 101: .category-list li * { text-transform: none; } /* don't */
1.132 mike 102:
103: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
104: .XXX > :first-child { margin-top: 0; }
105: p .XXX { line-height: 3em; }
106: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
107: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
108: .annotation :link, .annotation :visited { color: inherit; }
109: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
110: .annotation span { border: none ! important; }
111: .note { color: green; background: transparent; font-family: sans-serif; }
112: .warning { color: red; background: transparent; }
113: .note, .warning { font-weight: bolder; font-style: italic; }
114: .note em, .warning em, .note i, .warning i { font-style: normal; }
115: p.note, div.note { padding: 0.5em 2em; }
116: span.note { padding: 0 2em; }
117: .note p:first-child, .warning p:first-child { margin-top: 0; }
118: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
119: .warning:before { font-style: normal; }
120: p.note:before { content: 'Note: '; }
121: p.warning:before { content: '\26A0 Warning! '; }
122:
123: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
124: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
125: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
126: .bookkeeping dt { margin: 0.5em 2em 0; }
127: .bookkeeping dd { margin: 0 3em 0.5em; }
128:
129: h4 { position: relative; z-index: 3; }
130: h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
131: .element {
132: background: #EEEEFF;
133: color: black;
134: margin: 0 0 1em 0.15em;
135: padding: 0 1em 0.25em 0.75em;
136: border-left: solid #9999FF 0.25em;
137: position: relative;
138: z-index: 1;
139: }
140: .element:before {
141: position: absolute;
142: z-index: 2;
143: top: 0;
144: left: -1.15em;
145: height: 2em;
146: width: 0.9em;
147: background: #EEEEFF;
148: content: ' ';
149: border-style: none none solid solid;
150: border-color: #9999FF;
151: border-width: 0.25em;
152: }
153:
154: .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
155: td > .example:only-child { margin: 0 0 0 0.1em; }
156:
157: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
158: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
159: ul.domTree li li { list-style: none; }
160: ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
161: ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
162: ul.domTree span { font-style: italic; font-family: serif; }
163: ul.domTree .t1 code { color: purple; font-weight: bold; }
164: ul.domTree .t2 { font-style: normal; font-family: monospace; }
165: ul.domTree .t2 .name { color: black; font-weight: bold; }
166: ul.domTree .t2 .value { color: blue; font-weight: normal; }
167: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
168: ul.domTree .t7 code, .domTree .t8 code { color: green; }
169: ul.domTree .t10 code { color: teal; }
170:
171: body.dfnEnabled dfn { cursor: pointer; }
172: .dfnPanel {
173: display: inline;
174: position: absolute;
175: z-index: 10;
176: height: auto;
177: width: auto;
178: padding: 0.5em 0.75em;
179: font: small sans-serif, Droid Sans Fallback;
180: background: #DDDDDD;
181: color: black;
182: border: outset 0.2em;
183: }
184: .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
185: .dfnPanel :link, .dfnPanel :visited { color: black; }
186: .dfnPanel p { font-weight: bolder; }
187: .dfnPanel * + p { margin-top: 0.25em; }
188: .dfnPanel li { list-style-position: inside; }
189:
190: #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
191: #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
192: #configUI p label { display: block; }
193: #configUI #updateUI, #configUI .loginUI { text-align: center; }
194: #configUI input[type=button] { display: block; margin: auto; }
195:
196: fieldset { margin: 1em; padding: 0.5em 1em; }
197: fieldset > legend + * { margin-top: 0; }
198: fieldset > :last-child { margin-bottom: 0; }
199: fieldset p { margin: 0.5em 0; }
200:
1.138 mike 201: .stability {
202: position: fixed;
203: bottom: 0;
204: left: 0; right: 0;
205: margin: 0 auto 0 auto;
206: width: 50%;
207: background: maroon; color: yellow;
208: -webkit-border-radius: 1em 1em 0 0;
209: -moz-border-radius: 1em 1em 0 0;
210: border-radius: 1em 1em 0 0;
211: -moz-box-shadow: 0 0 1em #500;
212: -webkit-box-shadow: 0 0 1em #500;
213: box-shadow: 0 0 1em red;
214: padding: 0.5em 1em;
215: text-align: center;
216: }
217: .stability strong {
218: display: block;
219: }
220: .stability input {
221: appearance: none; margin: 0; border: 0; padding: 0.25em 0.5em; background: transparent; color: black;
222: position: absolute; top: -0.5em; right: 0; font: 1.25em sans-serif; text-align: center;
223: }
224: .stability input:hover {
225: color: white;
226: text-shadow: 0 0 2px black;
227: }
228: .stability input:active {
229: padding: 0.3em 0.45em 0.2em 0.55em;
230: }
231: .stability :link, .stability :visited,
232: .stability :link:hover, .stability :visited:hover {
233: background: transparent;
234: color: white;
235: }
236:
237: /**/
238: /**/
239: </style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text-css"><meta content="noindex" name="robots"><style type="text-css">
240: /**/
241: /**/
1.1 mike 242:
243: .applies thead th > * { display: block; }
244: .applies thead code { display: block; }
245: .applies tbody th { whitespace: nowrap; }
246: .applies td { text-align: center; }
247: .applies .yes { background: yellow; }
248:
249: .matrix, .matrix td { border: hidden; text-align: right; }
250: .matrix { margin-left: 2em; }
251:
252: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
253: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
254: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
255:
256: td.eg { border-width: thin; text-align: center; }
257:
258: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
259: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
260: #table-example-1 caption { padding-bottom: 0.5em; }
261: #table-example-1 thead, #table-example-1 tbody { border: none; }
262: #table-example-1 th, #table-example-1 td { border: solid thin; }
263: #table-example-1 th { font-weight: normal; }
264: #table-example-1 td { border-style: none solid; vertical-align: top; }
265: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
266: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
267: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
268: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
269: #table-example-1 tbody td:first-child::after { content: leader(". "); }
270: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
271: #table-example-1 tbody td:first-child + td { width: 10em; }
272: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
273: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
274:
275: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
276: .apple-table-examples * { font-family: "Times", serif; }
277: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
278: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
279: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
280: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
281: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
282: .apple-table-examples td { text-align: right; vertical-align: top; }
283: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
284: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
285: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
286: .apple-table-examples sup { line-height: 0; }
287:
288: .details-example img { vertical-align: top; }
289:
290: #base64-table {
291: white-space: nowrap;
292: font-size: 0.6em;
293: column-width: 6em;
294: column-count: 5;
295: column-gap: 1em;
296: -moz-column-width: 6em;
297: -moz-column-count: 5;
298: -moz-column-gap: 1em;
299: -webkit-column-width: 6em;
300: -webkit-column-count: 5;
301: -webkit-column-gap: 1em;
302: }
303: #base64-table thead { display: none; }
304: #base64-table * { border: none; }
305: #base64-table tbody td:first-child:after { content: ':'; }
306: #base64-table tbody td:last-child { text-align: right; }
307:
308: #named-character-references-table {
309: white-space: nowrap;
310: font-size: 0.6em;
311: column-width: 30em;
312: column-gap: 1em;
313: -moz-column-width: 30em;
314: -moz-column-gap: 1em;
315: -webkit-column-width: 30em;
316: -webkit-column-gap: 1em;
317: }
318: #named-character-references-table > table > tbody > tr > td:first-child + td,
319: #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
320: #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
321: #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
322:
323: .glyph.control { color: red; }
324:
325: @font-face {
326: font-family: 'Essays1743';
1.138 mike 327: src: url('fonts/Essays1743.ttf');
1.1 mike 328: }
329: @font-face {
330: font-family: 'Essays1743';
331: font-weight: bold;
1.138 mike 332: src: url('fonts/Essays1743-Bold.ttf');
1.1 mike 333: }
334: @font-face {
335: font-family: 'Essays1743';
336: font-style: italic;
1.138 mike 337: src: url('fonts/Essays1743-Italic.ttf');
1.1 mike 338: }
339: @font-face {
340: font-family: 'Essays1743';
341: font-style: italic;
342: font-weight: bold;
1.138 mike 343: src: url('fonts/Essays1743-BoldItalic.ttf');
1.1 mike 344: }
345:
1.138 mike 346: /**/
347: /**/
348: </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20{%20display:%20none;%20}%0Ahtml%20{%20border:%20solid%20yellow;%20}%20.domintro:before%20{%20display:%20none;%20}" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20{%20background:%20%23FFEEEE;%20}%20.domintro:before%20{%20background:%20%23FFEEEE;%20}" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script>
349:
350:
351: function getCookie(name) {
352: var params = location.search.substr(1).split("&");
353: for (var index = 0; index < params.length; index++) {
354: if (params[index] == name)
355: return "1";
356: var data = params[index].split("=");
357: if (data[0] == name)
358: return unescape(data[1]);
359: }
360: var cookies = document.cookie.split("; ");
361: for (var index = 0; index < cookies.length; index++) {
362: var data = cookies[index].split("=");
363: if (data[0] == name)
364: return unescape(data[1]);
365: }
366: return null;
1.1 mike 367: }
1.138 mike 368:
369:
370: </script><link href="scripting-1.html" rel="prev" title="4.3 Scripting">
1.105 mike 371: <link href="Overview.html#contents" rel="contents" title="Table of contents">
1.97 mike 372: <link href="the-noscript-element.html" rel="next" title="4.3.2 The noscript element">
1.138 mike 373: <body class="split chapter" onload="fixBrokenLink();"><div class="head" id="head" xmlns="">
1.9 mike 374: <div aria-haspopup="true" id="jumpIndexA-button" role="button" tabindex="0">jump
1.138 mike 375: <div id="jumpIndexA">
376: <ul><li><a class="noindex" href="the-a-element.html#the-a-element">a</a><a class="noindex" href="the-abbr-element.html#the-abbr-element">abbr</a><a class="noindex" href="the-address-element.html#the-address-element">address</a><a class="noindex" href="the-area-element.html#the-area-element">area</a><a class="noindex" href="the-article-element.html#the-article-element">article</a><a class="noindex" href="the-aside-element.html#the-aside-element">aside</a><a class="noindex" href="the-audio-element.html#the-audio-element">audio</a></li>
377: </ul><ul><li><a class="noindex" href="the-b-element.html#the-b-element">b</a><a class="noindex" href="the-base-element.html#the-base-element">base</a><a class="noindex" href="the-bdi-element.html#the-bdi-element">bdi</a><a class="noindex" href="the-bdo-element.html#the-bdo-element">bdo</a><a class="noindex" href="the-blockquote-element.html#the-blockquote-element">blockquote</a><a class="noindex" href="the-body-element.html#the-body-element">body</a><a class="noindex" href="the-br-element.html#the-br-element">br</a><a class="noindex" href="the-button-element.html#the-button-element">button</a></li>
378: </ul><ul><li><a class="noindex" href="the-canvas-element.html#the-canvas-element">canvas</a><a class="noindex" href="the-caption-element.html#the-caption-element">caption</a><a class="noindex" href="the-cite-element.html#the-cite-element">cite</a><a class="noindex" href="the-code-element.html#the-code-element">code</a><a class="noindex" href="the-col-element.html#the-col-element">col</a><a class="noindex" href="the-colgroup-element.html#the-colgroup-element">colgroup</a><a class="noindex" href="the-command-element.html#the-command-element">command</a></li>
379: </ul><ul><li><a class="noindex" href="the-datalist-element.html#the-datalist-element">datalist</a><a class="noindex" href="the-dd-element.html#the-dd-element">dd</a><a class="noindex" href="the-del-element.html#the-del-element">del</a><a class="noindex" href="the-details-element.html#the-details-element">details</a><a class="noindex" href="the-dfn-element.html#the-dfn-element">dfn</a><a class="noindex" href="the-div-element.html#the-div-element">div</a><a class="noindex" href="the-dl-element.html#the-dl-element">dl</a><a class="noindex" href="the-dt-element.html#the-dt-element">dt</a></li>
380: </ul><ul><li><a class="noindex" href="the-em-element.html#the-em-element">em</a><a class="noindex" href="the-embed-element.html#the-embed-element">embed</a><a class="noindex" href="the-fieldset-element.html#the-fieldset-element">fieldset</a><a class="noindex" href="the-figcaption-element.html#the-figcaption-element">figcaption</a><a class="noindex" href="the-figure-element.html#the-figure-element">figure</a><a class="noindex" href="the-footer-element.html#the-footer-element">footer</a><a class="noindex" href="the-form-element.html#the-form-element">form</a></li>
381: </ul><ul><li><a class="full-spec-link" href="http://dev.w3.org/html5/spec/.html#the-h1-h2-h3-h4-h5-and-h6-elements" title='Read about this "h1" reference in the full HTML5 spec.'>h1</a><a class="full-spec-link" href="http://dev.w3.org/html5/spec/.html#the-h1-h2-h3-h4-h5-and-h6-elements" title='Read about this "h2" reference in the full HTML5 spec.'>h2</a><a class="full-spec-link" href="http://dev.w3.org/html5/spec/.html#the-h1-h2-h3-h4-h5-and-h6-elements" title='Read about this "h3" reference in the full HTML5 spec.'>h3</a><a class="full-spec-link" href="http://dev.w3.org/html5/spec/.html#the-h1-h2-h3-h4-h5-and-h6-elements" title='Read about this "h4" reference in the full HTML5 spec.'>h4</a><a class="full-spec-link" href="http://dev.w3.org/html5/spec/.html#the-h1-h2-h3-h4-h5-and-h6-elements" title='Read about this "h5" reference in the full HTML5 spec.'>h5</a><a class="full-spec-link" href="http://dev.w3.org/html5/spec/.html#the-h1-h2-h3-h4-h5-and-h6-elements" title='Read about this "h6" reference in the full HTML5 spec.'>h6</a><a class="noindex" href="the-head-element.html#the-head-element">head</a><a class="noindex" href="the-header-element.html#the-header-element">header</a><a class="noindex" href="the-hgroup-element.html#the-hgroup-element">hgroup</a><a class="noindex" href="the-hr-element.html#the-hr-element">hr</a><a class="noindex" href="the-html-element.html#the-html-element">html</a></li>
382: </ul><ul><li><a class="noindex" href="the-i-element.html#the-i-element">i</a><a class="noindex" href="the-iframe-element.html#the-iframe-element">iframe</a><a class="noindex" href="the-img-element.html#the-img-element">img</a><a class="noindex" href="the-input-element.html#the-input-element">input</a><a class="noindex" href="the-ins-element.html#the-ins-element">ins</a><a class="noindex" href="the-kbd-element.html#the-kbd-element">kbd</a><a class="noindex" href="the-keygen-element.html#the-keygen-element">keygen</a></li>
383: </ul><ul><li><a class="noindex" href="the-label-element.html#the-label-element">label</a><a class="noindex" href="the-legend-element.html#the-legend-element">legend</a><a class="noindex" href="the-li-element.html#the-li-element">li</a><a class="noindex" href="the-link-element.html#the-link-element">link</a><a class="noindex" href="the-map-element.html#the-map-element">map</a><a class="noindex" href="the-mark-element.html#the-mark-element">mark</a><a class="noindex" href="the-menu-element.html#the-menu-element">menu</a><a class="noindex" href="the-meta-element.html#the-meta-element">meta</a><a class="noindex" href="the-meter-element.html#the-meter-element">meter</a></li>
384: </ul><ul><li><a class="noindex" href="the-nav-element.html#the-nav-element">nav</a><a class="noindex" href="the-noscript-element.html#the-noscript-element">noscript</a><a class="noindex" href="the-object-element.html#the-object-element">object</a><a class="noindex" href="the-ol-element.html#the-ol-element">ol</a><a class="noindex" href="the-optgroup-element.html#the-optgroup-element">optgroup</a><a class="noindex" href="the-option-element.html#the-option-element">option</a><a class="noindex" href="the-output-element.html#the-output-element">output</a></li>
385: </ul><ul><li><a class="noindex" href="the-p-element.html#the-p-element">p</a><a class="noindex" href="the-param-element.html#the-param-element">param</a><a class="noindex" href="the-pre-element.html#the-pre-element">pre</a><a class="noindex" href="the-progress-element.html#the-progress-element">progress</a><a class="noindex" href="the-q-element.html#the-q-element">q</a><a class="noindex" href="the-rp-element.html#the-rp-element">rp</a><a class="noindex" href="the-rt-element.html#the-rt-element">rt</a><a class="noindex" href="the-ruby-element.html#the-ruby-element">ruby</a></li>
386: </ul><ul><li><a class="noindex" href="the-s-element.html#the-s-element">s</a><a class="noindex" href="the-samp-element.html#the-samp-element">samp</a><a class="noindex" href="#the-script-element">script</a><a class="noindex" href="the-section-element.html#the-section-element">section</a><a class="noindex" href="the-select-element.html#the-select-element">select</a><a class="noindex" href="the-small-element.html#the-small-element">small</a><a class="noindex" href="the-source-element.html#the-source-element">source</a><a class="noindex" href="the-span-element.html#the-span-element">span</a></li>
387: </ul><ul><li><a class="noindex" href="the-strong-element.html#the-strong-element">strong</a><a class="noindex" href="the-style-element.html#the-style-element">style</a><a class="noindex" href="the-sub-and-sup-elements.html#the-sub-and-sup-elements">sub</a><a class="noindex" href="the-summary-element.html#the-summary-element">summary</a><a class="noindex" href="the-sub-and-sup-elements.html#the-sub-and-sup-elements">sup</a></li>
388: </ul><ul><li><a class="noindex" href="the-table-element.html#the-table-element">table</a><a class="noindex" href="the-tbody-element.html#the-tbody-element">tbody</a><a class="noindex" href="the-td-element.html#the-td-element">td</a><a class="noindex" href="the-textarea-element.html#the-textarea-element">textarea</a><a class="noindex" href="the-tfoot-element.html#the-tfoot-element">tfoot</a><a class="noindex" href="the-th-element.html#the-th-element">th</a><a class="noindex" href="the-thead-element.html#the-thead-element">thead</a><a class="noindex" href="the-time-element.html#the-time-element">time</a><a class="noindex" href="the-title-element.html#the-title-element">title</a></li>
389: </ul><ul><li><a class="noindex" href="the-tr-element.html#the-tr-element">tr</a><a class="noindex" href="the-track-element.html#the-track-element">track</a><a class="noindex" href="the-u-element.html#the-u-element">u</a><a class="noindex" href="the-ul-element.html#the-ul-element">ul</a><a class="noindex" href="the-var-element.html#the-var-element">var</a><a class="noindex" href="the-video-element.html#the-video-element">video</a><a class="noindex" href="the-wbr-element.html#the-wbr-element">wbr</a></li>
390: </ul><ul class="jumpIndexA-other"><li><a class="noindex" href="global-attributes.html#global-attributes">global
391: attributes</a><a class="noindex" href="index-of-terms.html#index-of-terms">terms</a></li>
392: </ul></div>
393: </div>
394: <script src="jump-indexes.js">
395: </script><p xmlns="http://www.w3.org/1999/xhtml"><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
396: <h1 xmlns="http://www.w3.org/1999/xhtml">HTML5</h1>
397: </div>
398: <div class="prev_next">
1.137 mike 399: <a href="scripting-1.html">← 4.3 Scripting</a> –
1.1 mike 400: <a href="Overview.html#contents">Table of contents</a> –
1.137 mike 401: <a href="the-noscript-element.html">4.3.2 The noscript element →</a>
1.138 mike 402: <ol class="toc"><li><ol><li><ol><li><a href="the-script-element.html#the-script-element"><span class="secno">4.3.1</span>
403: The <code>script</code> element</a>
404: <ol><li><a href="the-script-element.html#scriptingLanguages"><span class="secno">4.3.1.1</span> Scripting languages</a><li><a href="the-script-element.html#restrictions-for-contents-of-script-elements" id="4.3.1.2-restrictions-for-contents-of-script-elements"><span class="secno">4.3.1.2</span> Restrictions for contents of
405: <code>script</code> elements</a><li><a href="the-script-element.html#inline-documentation-for-external-scripts" id="4.3.1.3-inline-documentation-for-external-scripts"><span class="secno">4.3.1.3</span> Inline documentation for external
406: scripts</a></ol></ol></ol></ol></div>
407:
408: <h4 id="the-script-element"><span class="secno">4.3.1</span> The
409: <dfn id="script"><code>script</code></dfn> element</h4>
410: <dl class="element"><dt><a href="element-definitions.html#element-dfn-categories" id="element-dfn-categories_7" title="element-dfn-categories">Categories</a>:</dt>
411: <dd><a href="content-models.html#metadata-content-0" id="metadata-content_12">Metadata
412: content</a>.</dd>
413: <dd><a href="content-models.html#flow-content-1" id="flow-content_14">Flow
414: content</a>.</dd>
415: <dd><a href="content-models.html#phrasing-content-1" id="phrasing-content_16">Phrasing
416: content</a>.</dd>
417: <dt><a href="element-definitions.html#element-dfn-contexts" id="element-dfn-contexts_7" title="element-dfn-contexts">Contexts in which this element can be
418: used</a>:</dt>
419: <dd>Where <a href="content-models.html#metadata-content-0" id="metadata-content_13">metadata content</a> is expected.</dd>
420: <dd>Where <a href="content-models.html#phrasing-content-1" id="phrasing-content_17">phrasing content</a> is expected.</dd>
421: <dt><a href="element-definitions.html#element-dfn-content-model" id="element-dfn-content-model_7" title="element-dfn-content-model">Content model</a>:</dt>
422: <dd>If there is no <code title="attr-script-src"><a href="#attr-script-src" id="src_1">src</a></code> attribute, depends on
423: the value of the <code title="attr-script-type"><a href="#attr-script-type" id="type_6">type</a></code> attribute, but must
424: match <a href="#restrictions-for-contents-of-script-elements" id="script-content-restrictions">script content restrictions</a>.</dd>
425: <dd>If there <em>is</em> a <code title="attr-script-src"><a href="#attr-script-src" id="src_2">src</a></code> attribute, the element
426: must be either empty or contain only <a href="#inline-documentation-for-external-scripts" id="script-documentation">script documentation</a> that also matches
427: <a href="#restrictions-for-contents-of-script-elements" id="script-content-restrictions_0">script content
428: restrictions</a>.</dd>
429: <dt><a href="element-definitions.html#element-dfn-attributes" id="element-dfn-attributes_7" title="element-dfn-attributes">Content attributes</a>:</dt>
430: <dd><a href="global-attributes.html#global-attributes" id="global-attributes_7">Global
431: attributes</a></dd>
432: <dd><code title="attr-script-src"><a href="#attr-script-src" id="src_3">src</a></code></dd>
433: <dd><code title="attr-script-async"><a href="#attr-script-async" id="async">async</a></code></dd>
434: <dd><code title="attr-script-defer"><a href="#attr-script-defer" id="defer">defer</a></code></dd>
435: <dd><code title="attr-script-type"><a href="#attr-script-type" id="type_7">type</a></code></dd>
436: <dd><code title="attr-script-charset"><a href="#attr-script-charset" id="charset_10">charset</a></code></dd>
437: <dt><a href="element-definitions.html#element-dfn-dom" id="element-dfn-dom_7" title="element-dfn-dom">DOM interface</a>:</dt>
438: <!--TOPIC:DOM APIs-->
439: <dd>
440: <pre class="idl">
441: interface <dfn id="htmlscriptelement">HTMLScriptElement</dfn> : <a href="elements.html#htmlelement" id="htmlelement_12">HTMLElement</a> {
442: attribute DOMString <a href="#dom-script-src" title="dom-script-src">src</a>;
443: attribute boolean <a href="#dom-script-async" title="dom-script-async">async</a>;
444: attribute boolean <a href="#dom-script-defer" title="dom-script-defer">defer</a>;
445: attribute DOMString <a href="#dom-script-type" title="dom-script-type">type</a>;
446: attribute DOMString <a href="#dom-script-charset" title="dom-script-charset">charset</a>;
1.91 mike 447: attribute DOMString <a href="#dom-script-text" title="dom-script-text">text</a>;
1.138 mike 448: };
449: </pre></dd>
450: </dl><!--TOPIC:HTML--><p>The <code><a href="#the-script-element">script</a></code>
451: element allows authors to include dynamic script and data blocks in
452: their documents. The element does not <a href="#represents" title="represents">represent</a> content for the user.</p>
453: <p>When used to include dynamic scripts, the scripts may either be
454: embedded inline or may be imported from an external file using the
455: <code title="attr-script-src"><a href="#attr-script-src" id="src_4">src</a></code> attribute. If the language is not that
456: described by "<code title="">text/javascript</code>", then the
457: <code title="attr-script-type"><a href="#attr-script-type" id="type_8">type</a></code> attribute must be present, as described
458: below. Whatever language is used, the contents of the
459: <code><a href="#the-script-element">script</a></code> element must
460: conform with the requirements of that language's specification.</p>
461: <p>When used to include data blocks (as opposed to scripts), the
462: data must be embedded inline, the format of the data must be given
463: using the <code title="attr-script-type"><a href="#attr-script-type" id="type_9">type</a></code> attribute, the
464: <code title="attr-script-src"><a href="#attr-script-src" id="src_5">src</a></code> attribute must not be specified, and the
465: contents of the <code><a href="#the-script-element">script</a></code> element must conform to the
466: requirements defined for the format used.</p>
467: <p>The <dfn id="attr-script-type" title="attr-script-type"><code>type</code></dfn> attribute gives the
468: language of the script or format of the data. If the attribute is
469: present, its value must be a <a href="infrastructure.html#valid-mime-type" id="valid-mime-type_3">valid MIME type</a>. The <code title="">charset</code> parameter must not be specified. The default,
470: which is used if the attribute is absent, is "<code title="">text/javascript</code>".</p>
471: <p>The <dfn id="attr-script-src" title="attr-script-src"><code>src</code></dfn> attribute, if specified,
472: gives the address of the external script resource to use. The value
473: of the attribute must be a <a href="urls.html#valid-non-empty-url-potentially-surrounded-by-spaces" id="valid-non-empty-url-potentially-surrounded-by-spaces_2">valid
474: non-empty URL potentially surrounded by spaces</a> identifying a
475: script resource of the type given by the <code title="attr-script-type"><a href="#attr-script-type" id="type_10">type</a></code> attribute, if the attribute is present,
476: or of the type "<code title="">text/javascript</code>", if the
477: attribute is absent. A resource is a script resource of a given
478: type if that type identifies a scripting language and the resource
479: conforms with the requirements of that language's
480: specification.</p>
481: <p>The <dfn id="attr-script-charset" title="attr-script-charset"><code>charset</code></dfn> attribute gives
482: the character encoding of the external script resource. The
483: attribute must not be specified if the <code title="attr-script-src"><a href="#attr-script-src" id="src_6">src</a></code> attribute is not present. If the attribute
484: is set, its value must be a valid character encoding name, must be
485: an <a href="infrastructure.html#ascii-case-insensitive" id="ascii-case-insensitive_10">ASCII case-insensitive</a> match for
486: the <a href="infrastructure.html#preferred-mime-name" id="preferred-mime-name_1">preferred MIME name</a> for that encoding,
487: and must match the encoding given in the <code title="">charset</code> parameter of the <a href="#content-type" title="Content-Type">Content-Type metadata</a> of the external file, if
488: any. <a href="references.html#refsIANACHARSET">[IANACHARSET]</a></p>
489: <p>The <dfn id="attr-script-async" title="attr-script-async"><code>async</code></dfn> and <dfn id="attr-script-defer" title="attr-script-defer"><code>defer</code></dfn> attributes are
490: <a href="common-microsyntaxes.html#boolean-attribute" id="boolean-attribute_1" title="boolean attribute">boolean attributes</a> that indicate how the
491: script should be executed. The <code title="attr-script-defer"><a href="#attr-script-defer" id="defer_0">defer</a></code> and <code title="attr-script-async"><a href="#attr-script-async" id="async_0">async</a></code> attributes must not be specified if the
492: <code title="attr-script-src"><a href="#attr-script-src" id="src_7">src</a></code> attribute is not present.</p>
493: <p>There are three possible modes that can be selected using these
494: attributes. If the <code title="attr-script-async"><a href="#attr-script-async" id="async_1">async</a></code> attribute is
495: present, then the script will be executed asynchronously, as soon
496: as it is available. If the <code title="attr-script-async"><a href="#attr-script-async" id="async_2">async</a></code> attribute is not
497: present but the <code title="attr-script-defer"><a href="#attr-script-defer" id="defer_1">defer</a></code> attribute is
498: present, then the script is executed when the page has finished
499: parsing. If neither attribute is present, then the script is
500: fetched and executed immediately, before the user agent continues
501: parsing the page.</p>
502: <p class="note">The exact processing details for these attributes
503: are, for mostly historical reasons, somewhat non-trivial, involving
504: a number of aspects of HTML. The implementation requirements are
505: therefore by necessity scattered throughout the specification. The
506: algorithms below (in this section) describe the core of this
507: processing, but these algorithms reference and are referenced by
508: the parsing rules for <code><a href="#the-script-element">script</a></code> <a href="#scriptTag">start</a> and <a href="#scriptEndTag">end</a> tags in
509: HTML, <a href="#scriptForeignEndTag">in foreign content</a>, and
510: <a href="#scriptTagXML">in XML</a>, the rules for the <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code> method, the
511: handling of <a href="webappapis.html#scripting">scripting</a>, etc.</p>
512: <p>The <code title="attr-script-defer"><a href="#attr-script-defer" id="defer_2">defer</a></code> attribute may be specified even if
513: the <code title="attr-script-async"><a href="#attr-script-async" id="async_3">async</a></code> attribute is specified, to cause
514: legacy Web browsers that only support <code title="attr-script-defer"><a href="#attr-script-defer" id="defer_3">defer</a></code> (and not <code title="attr-script-async"><a href="#attr-script-async" id="async_4">async</a></code>) to fall back to the <code title="attr-script-defer"><a href="#attr-script-defer" id="defer_4">defer</a></code> behavior instead of the synchronous
515: blocking behavior that is the default.</p>
516: <p>Changing the <code title="attr-script-src"><a href="#attr-script-src" id="src_8">src</a></code>, <code title="attr-script-type"><a href="#attr-script-type" id="type_11">type</a></code>, <code title="attr-script-charset"><a href="#attr-script-charset" id="charset_11">charset</a></code>, <code title="attr-script-async"><a href="#attr-script-async" id="async_5">async</a></code>, and <code title="attr-script-defer"><a href="#attr-script-defer" id="defer_5">defer</a></code> attributes dynamically has no direct
517: effect; these attribute are only used at specific times described
518: below.</p>
519: <!-- by implication, changes to the base URL
520: also have no effect -->
521: <!--TOPIC:DOM APIs-->
522: <dl class="domintro"><dt><var title="">script</var> . <code title="dom-script-text"><a href="#dom-script-text">text</a></code> [ =
523: <var title="">value</var> ]</dt>
524: <dd>
525: <p>Returns the contents of the element, ignoring child nodes that
526: aren't <code><a href="#text-0">Text</a></code> nodes.</p>
527: <p>Can be set, to replace the element's children with the given
528: value.</p>
529: </dd>
530: </dl><!--TOPIC:HTML--><p class="note">When inserted using the <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code> method,
531: <code><a href="#the-script-element">script</a></code> elements
532: execute (typically synchronously), but when inserted using
533: <code title="dom-innerHTML"><a href="#dom-innerhtml">innerHTML</a></code> and <code title="dom-outerHTML"><a href="#dom-outerhtml">outerHTML</a></code>
534: attributes, they do not execute at all.</p>
535: <div class="example">
536: <p>In this example, two <code><a href="#the-script-element">script</a></code> elements are used. One
537: embeds an external script, and the other includes some data.</p>
538: <pre>
539: <script src="game-engine.js"></script>
540: <script type="text-x-game-map">
1.1 mike 541: ........U.........e
542: o............A....e
543: .....A.....AAA....e
544: .A..AAA...AAAAA...e
1.138 mike 545: </script>
546: </pre>
547: <p>The data in this case might be used by the script to generate
548: the map of a video game. The data doesn't have to be used that way,
549: though; maybe the map data is actually embedded in other parts of
550: the page's markup, and the data block here is just used by the
551: site's search engine to help users who are looking for particular
552: features in their game maps.</p>
553: </div>
554: <div class="example">
555: <p>The following sample shows how a script element can be used to
556: define a function that is then used by other parts of the document.
557: It also shows how a <code><a href="#the-script-element">script</a></code> element can be used to
558: invoke script while the document is being parsed, in this case to
559: initialize the form's output.</p>
560: <pre>
561: <script>
1.1 mike 562: function calculate(form) {
563: var price = 52000;
564: if (form.elements.brakes.checked)
565: price += 1000;
566: if (form.elements.radio.checked)
567: price += 2500;
568: if (form.elements.turbo.checked)
569: price += 5000;
570: if (form.elements.sticker.checked)
571: price += 250;
572: form.elements.result.value = price;
573: }
574: </script>
575: <form name="pricecalc" onsubmit="return false" onchange="calculate(this)">
576: <fieldset>
577: <legend>Work out the price of your car</legend>
578: <p>Base cost: £52000.</p>
579: <p>Select additional options:</p>
580: <ul>
581: <li><label><input type=checkbox name=brakes> Ceramic brakes (£1000)</label></li>
582: <li><label><input type=checkbox name=radio> Satellite radio (£2500)</label></li>
583: <li><label><input type=checkbox name=turbo> Turbo charger (£5000)</label></li>
584: <li><label><input type=checkbox name=sticker> "XZ" sticker (£250)</label></li>
585: </ul>
586: <p>Total: £<output name=result></output></p>
587: </fieldset>
588: <script>
589: calculate(document.forms.pricecalc);
590: </script>
1.138 mike 591: </form>
592: </pre></div>
593: <h5 id="scriptingLanguages"><span class="secno">4.3.1.1</span>
594: Scripting languages</h5>
595: <p>The following lists some <a href="infrastructure.html#mime-type" id="mime-type_5">MIME type</a> strings and the languages to which they
596: refer:</p>
597: <dl><dt>"<code>application/ecmascript</code>"</dt>
598: <dt>"<code>application/javascript</code>"</dt>
599: <dt>"<code>application/x-ecmascript</code>"</dt>
600: <dt>"<code>application/x-javascript</code>"</dt>
601: <dt>"<code>text/ecmascript</code>"</dt>
602: <dt>"<code>text/javascript</code>"</dt>
603: <dt>"<code>text/javascript1.0</code>"</dt>
604: <dt>"<code>text/javascript1.1</code>"</dt>
605: <dt>"<code>text/javascript1.2</code>"</dt>
606: <dt>"<code>text/javascript1.3</code>"</dt>
607: <dt>"<code>text/javascript1.4</code>"</dt>
608: <dt>"<code>text/javascript1.5</code>"</dt>
609: <dt>"<code>text/jscript</code>"</dt>
610: <dt>"<code>text/livescript</code>"</dt>
611: <dt>"<code>text/x-ecmascript</code>"</dt>
612: <dt>"<code>text/x-javascript</code>"</dt>
613: <dd>JavaScript. <a href="references.html#refsECMA262">[ECMA262]</a></dd>
614: <dt>"<code>text/javascript;e4x=1</code>"</dt>
615: <dd>JavaScript with ECMAScript for XML. <a href="references.html#refsECMA357">[ECMA357]</a></dd>
616: </dl><h5 id="restrictions-for-contents-of-script-elements"><span class="secno">4.3.1.2</span> <dfn title="script content restrictions">Restrictions for contents of
617: <code>script</code> elements</dfn></h5>
618: <p>The <code><a href="#textcontent">textContent</a></code> of a
619: <code><a href="#the-script-element">script</a></code> element must
620: match the <code title="">script</code> production in the following
621: ABNF, the character set for which is Unicode. <a href="references.html#refsABNF">[ABNF]</a></p>
622: <pre>
623: script = data1 *( escape [ script-start data3 ] "-->" data1 ) [ escape ]
1.1 mike 624: escape = "<!--" data2 *( script-start data3 script-end data2 )
625:
626: data1 = <any string that doesn't contain a substring that matches not-data1>
1.138 mike 627: not-data1 = <!-- script-end / -->"<!--"
628: <!-- the script-end is redundant here since it would close the element -->
1.1 mike 629:
630: data2 = <any string that doesn't contain a substring that matches not-data2>
1.138 mike 631: not-data2 = <!-- script-end / -->script-start / "-->"
632: <!-- the script-end is redundant here since it would close the element -->
1.1 mike 633:
634: data3 = <any string that doesn't contain a substring that matches not-data3>
635: not-data3 = script-end / "-->"
636:
637: script-start = lt s c r i p t tag-end
638: script-end = lt slash s c r i p t tag-end
639:
640: lt = %x003C ; U+003C LESS-THAN SIGN character (<)
1.135 mike 641: slash = %x002F ; "/" (U+002F) character
1.1 mike 642:
643: s = %x0053 ; U+0053 LATIN CAPITAL LETTER S
644: s =/ %x0073 ; U+0073 LATIN SMALL LETTER S
645: c = %x0043 ; U+0043 LATIN CAPITAL LETTER C
646: c =/ %x0063 ; U+0063 LATIN SMALL LETTER C
647: r = %x0052 ; U+0052 LATIN CAPITAL LETTER R
648: r =/ %x0072 ; U+0072 LATIN SMALL LETTER R
649: i = %x0049 ; U+0049 LATIN CAPITAL LETTER I
650: i =/ %x0069 ; U+0069 LATIN SMALL LETTER I
651: p = %x0050 ; U+0050 LATIN CAPITAL LETTER P
652: p =/ %x0070 ; U+0070 LATIN SMALL LETTER P
653: t = %x0054 ; U+0054 LATIN CAPITAL LETTER T
654: t =/ %x0074 ; U+0074 LATIN SMALL LETTER T
655:
1.135 mike 656: tag-end = %x0009 ; "tab" (U+0009)
657: tag-end =/ %x000A ; "LF" (U+000A)
658: tag-end =/ %x000C ; "FF" (U+000C)
1.1 mike 659: tag-end =/ %x0020 ; U+0020 SPACE
1.135 mike 660: tag-end =/ %x002F ; "/" (U+002F)
1.138 mike 661: tag-end =/ %x003E ; U+003E GREATER-THAN SIGN (>)
662: </pre>
663: <p>When a <code><a href="#the-script-element">script</a></code>
664: element contains <a href="#inline-documentation-for-external-scripts" id="script-documentation_0">script documentation</a>, there are
665: further restrictions on the contents of the element, as described
666: in the section below.</p>
667: <h5 id="inline-documentation-for-external-scripts"><span class="secno">4.3.1.3</span> <dfn title="script documentation">Inline
668: documentation for external scripts</dfn></h5>
669: <p>If a <code><a href="#the-script-element">script</a></code>
670: element's <code title="attr-script-src"><a href="#attr-script-src" id="src_9">src</a></code> attribute is specified, then the contents
671: of the <code><a href="#the-script-element">script</a></code>
672: element, if any, must be such that the value of the <code title="dom-script-text"><a href="#dom-script-text">text</a></code> IDL
673: attribute, which is derived from the element's contents, matches
674: the <code title="">documentation</code> production in the following
675: ABNF, the character set for which is Unicode. <a href="references.html#refsABNF">[ABNF]</a></p>
676: <pre>
677: documentation = *( *( space / tab / comment ) [ line-comment ] newline )
1.1 mike 678: comment = slash star *( not-star / star not-slash ) 1*star slash
679: line-comment = slash slash *not-newline
680:
681: ; characters
1.135 mike 682: tab = %x0009 ; "tab" (U+0009)
683: newline = %x000A ; "LF" (U+000A)
1.1 mike 684: space = %x0020 ; U+0020 SPACE
1.135 mike 685: star = %x002A ; "*" (U+002A)
686: slash = %x002F ; "/" (U+002F)
1.1 mike 687: not-newline = %x0000-0009 / %x000B-10FFFF
1.135 mike 688: ; a <a href="infrastructure.html#unicode-character" id="unicode-character_2">Unicode character</a> other than "LF" (U+000A)
1.1 mike 689: not-star = %x0000-0029 / %x002B-10FFFF
1.135 mike 690: ; a <a href="infrastructure.html#unicode-character" id="unicode-character_3">Unicode character</a> other than "*" (U+002A)
1.1 mike 691: not-slash = %x0000-002E / %x0030-10FFFF
1.138 mike 692: ; a <a href="infrastructure.html#unicode-character" id="unicode-character_4">Unicode character</a> other than "/" (U+002F)
693: </pre>
694: <p class="note">This corresponds to putting the contents of the
695: element in JavaScript comments.</p>
696: <p class="note">This requirement is in addition to the earlier
697: restrictions on the syntax of contents of <code><a href="#the-script-element">script</a></code> elements.</p>
698: <div class="example">
699: <p>This allows authors to include documentation, such as license
700: information or API information, inside their documents while still
701: referring to external script files. The syntax is constrained so
702: that authors don't accidentally include what looks like valid
703: script while also providing a <code title="attr-script-src"><a href="#attr-script-src" id="src_10">src</a></code> attribute.</p>
704: <pre>
705: <script src="cool-effects.js">
1.1 mike 706: // create new instances using:
707: // var e = new Effect();
708: // start the effect using .play, stop using .stop:
709: // e.play();
710: // e.stop();
1.138 mike 711: </script>
712: </pre></div>
Webmaster