NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 512 - Allow authors to include documentation inside <script> blocks that have src='' attributes. (credit: sp)
Allow authors to include documentation inside <script> blocks that have src='...
Status: RESOLVED FIXED
Product: Validator.nu
Classification: Unclassified
Component: HTML5 schema
HEAD
All All
: P2 normal
Assigned To: Nobody
http://svn.whatwg.org/webapps/source?...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-27 14:14 CEST by Henri Sivonen
Modified: 2011-05-19 17:39 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henri Sivonen 2009-05-27 14:14:23 CEST
Index: source
===================================================================
--- source	(revision 2673)
+++ source	(revision 2674)
@@ -10157,7 +10157,8 @@
    attribute, depends on the value of the <code
    title="attr-script-type">type</code> attribute.</dd>
    <dd>If there <em>is</em> a <code title="attr-script-src">src</code>
-   attribute, the element must be empty.</dd>
+   attribute, the element must be either empty or contain only
+   <span>script documentation</span>.</dd>
    <dt>Element-specific attributes:</dt>
    <dd><code title="attr-script-src">src</code></dd>
    <dd><code title="attr-script-async">async</code></dd>
@@ -10787,6 +10788,49 @@
   -->
 
 
+  <h5><dfn title="script documentation">Inline documentation for external scripts</dfn></h5>
+
+  <p>If a <code>script</code> element's <code
+  title="attr-script-src">src</code> attribute is specified, then the
+  contents of the <code>script</code> element, if any, must be such
+  that the value of the DOM <code title="dom-script-text">text</code>
+  attribute, which is derived from the element's contents, matches the
+  <code>documentation</code> production in the following ABNF. <a
+  href="#refsABNF">[ABNF]</a></p> <!-- XXX
+  ftp://ftp.rfc-editor.org/in-notes/std/std68.txt -->
+
+  <pre>documentation ::= *( *( space / tab / comment ) [ line-comment ] newline )
+comment       ::= slash star *( not-star / star not-slash ) 1*star slash
+line-comment  ::= slash slash *not-newline
+space         ::= &lt; a U+0020 SPACE character >
+tab           ::= &lt; a U+0009 TAB character >
+newline       ::= &lt; a U+000A LINE FEED character >
+star          ::= &lt; a U+002A ASTERISK character >
+slash         ::= &lt; a U+002F SOLIDUS character >
+not-star      ::= &lt; a single Unicode character other than a U+002A ASTERISK character >
+not-slash     ::= &lt; a single Unicode character other than a U+002F SOLIDUS character >
+not-newline   ::= &lt; a single Unicode character other than a U+000A LINE FEED character ></pre>
+
+  <div class="example">
+
+   <p>This allows authors to include documentation, such as license
+   information or API information, inside their documents while still
+   referring to external script files. The syntax is constrained so
+   that authors don't accidentally include what looks like valid
+   script while also providing a <code
+   title="attr-script-src">src</code> attribute.</p>
+
+   <pre>&lt;script src="cool-effects.js">
+ // create new instances using:
+ //    var e = new Effect();
+ // start the effect using .play, stop using .stop:
+ //    e.play();
+ //    e.stop();
+&lt;/script></pre>
+
+  </div>
+
+
 
   <h4>The <dfn><code>noscript</code></dfn> element</h4>
 
@@ -61295,6 +61339,8 @@
        form data set the way that is done today.
  XXX * placeholder="" for <textarea>, e.g. as seen on:
        http://code.google.com/p/support/issues/detail?id=1#makechanges
+ XXX * become more consistent about what markup we use to mark up
+       productions (nothing? <i>? <code>?)
 -->
 
  </body>
Comment 1 Henri Sivonen 2011-05-19 17:39:10 CEST
Fixed by Mike(tm).