[MSE] JavaScripti/CSS refactor.
Refactoring JavaScript and CSS so that they can be reused by the
byte stream format registry and new byte stream format specs.
--- a/media-source/media-source-respec.html Thu Oct 31 14:59:50 2013 -0700
+++ b/media-source/media-source-respec.html Mon Nov 04 11:16:03 2013 -0800
@@ -30,6 +30,31 @@
company: "Netflix Inc.", companyURL: "http://www.netflix.com/" },
],
+ mseDefGroupName: "media-source",
+ mseContributors: [
+ "Bob Lund",
+ "Alex Giladi",
+ "Duncan Rowden",
+ "Mark Vickers",
+ "Glenn Adams",
+ "Frank Galligan",
+ "Steven Robertson",
+ "Matt Ward",
+ "David Dorwin",
+ "Kevin Streeter",
+ "Joe Steele",
+ "Michael Thornburgh",
+ "Philip Jägenstedt",
+ "John Simmons",
+ "Jerry Smith",
+ "Pierre Lemieux",
+ "Cyril Concolato",
+ "Ralph Giles",
+ "David Singer",
+ "Tatsuya Igarashi",
+ "Chris Poole"
+ ],
+
// name of the WG
wg: "HTML Working Group",
@@ -67,37 +92,14 @@
postProcess: [ mediaSourcePostProcessor ]
};
</script>
+
<!-- script to register bugs -->
<script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
<meta name="bug.short_desc" content="[MSE] ">
<meta name="bug.product" content="HTML WG">
<meta name="bug.component" content="Media Source Extensions">
- <style type="text/css">
- .nonnormative { color: green; margin: 2em 0 2em 0em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
- .nonnormative h3 { color: inherit; background: inherit; }
- .nonnormative:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This section is non-normative.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
-
- .iso-box { font-weight: bold; }
- .iso-var { font-style: italic; }
-
- table.old-table { border-collapse: collapse; border-style: hidden hidden none hidden; }
- table.old-table thead, table tbody { border-bottom: solid; }
- table.old-table tbody th:first-child { border-left: solid; }
- table.old-table tbody th { text-align: left; }
- table.old-table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
-
- dl.switch { padding-left: 2em; }
- dl.switch > dt { text-indent: -1.5em; }
- dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
-
- p + * > li, dd li { margin: 1em 0; }
-
- @media screen { code :link, code :visited { color: inherit; } }
-
- /* fix bug entry form styling */
- body > form { padding: 4px; border: 1px solid red; background-color: white; }
- </style>
+ <link rel="stylesheet" href="mse.css">
</head>
<body>
--- a/media-source/media-source.html Thu Oct 31 14:59:50 2013 -0700
+++ b/media-source/media-source.html Mon Nov 04 11:16:03 2013 -0800
@@ -6,153 +6,14 @@
+
<!-- script to register bugs -->
<script src="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/assets/scripts/bug-assist.js"></script>
<meta name="bug.short_desc" content="[MSE] ">
<meta name="bug.product" content="HTML WG">
<meta name="bug.component" content="Media Source Extensions">
- <style type="text/css">
- .nonnormative { color: green; margin: 2em 0 2em 0em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
- .nonnormative h3 { color: inherit; background: inherit; }
- .nonnormative:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This section is non-normative.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
-
- .iso-box { font-weight: bold; }
- .iso-var { font-style: italic; }
-
- table.old-table { border-collapse: collapse; border-style: hidden hidden none hidden; }
- table.old-table thead, table tbody { border-bottom: solid; }
- table.old-table tbody th:first-child { border-left: solid; }
- table.old-table tbody th { text-align: left; }
- table.old-table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
-
- dl.switch { padding-left: 2em; }
- dl.switch > dt { text-indent: -1.5em; }
- dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
-
- p + * > li, dd li { margin: 1em 0; }
-
- @media screen { code :link, code :visited { color: inherit; } }
-
- /* fix bug entry form styling */
- body > form { padding: 4px; border: 1px solid red; background-color: white; }
- </style>
- <style>/*****************************************************************
- * ReSpec 3 CSS
- * Robin Berjon - http://berjon.com/
- *****************************************************************/
-
-/* --- INLINES --- */
-em.rfc2119 {
- text-transform: lowercase;
- font-variant: small-caps;
- font-style: normal;
- color: #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
- border: none;
-}
-
-dfn {
- font-weight: bold;
-}
-
-a.internalDFN {
- color: inherit;
- border-bottom: 1px solid #99c;
- text-decoration: none;
-}
-
-a.externalDFN {
- color: inherit;
- border-bottom: 1px dotted #ccc;
- text-decoration: none;
-}
-
-a.bibref {
- text-decoration: none;
-}
-
-cite .bibref {
- font-style: normal;
-}
-
-code {
- color: #ff4500;
-}
-
-
-/* --- --- */
-ol.algorithm { counter-reset:numsection; list-style-type: none; }
-ol.algorithm li { margin: 0.5em 0; }
-ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }
-
-/* --- TOC --- */
-.toc a, .tof a {
- text-decoration: none;
-}
-
-a .secno, a .figno {
- color: #000;
-}
-
-ul.tof, ol.tof {
- list-style: none outside none;
-}
-
-.caption {
- margin-top: 0.5em;
- font-style: italic;
-}
-
-/* --- TABLE --- */
-table.simple {
- border-spacing: 0;
- border-collapse: collapse;
- border-bottom: 3px solid #005a9c;
-}
-
-.simple th {
- background: #005a9c;
- color: #fff;
- padding: 3px 5px;
- text-align: left;
-}
-
-.simple th[scope="row"] {
- background: inherit;
- color: inherit;
- border-top: 1px solid #ddd;
-}
-
-.simple td {
- padding: 3px 10px;
- border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
- background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
- margin-top: 0;
-}
-
-.section dd > p:last-child {
- margin-bottom: 0;
-}
-
-.section dd {
- margin-bottom: 1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
- margin-bottom: 0;
-}
-</style><style>/* --- ISSUES/NOTES --- */
+ <style>/* --- ISSUES/NOTES --- */
div.issue-title, div.note-title {
padding-right: 1em;
min-width: 7.5em;
@@ -420,6 +281,122 @@
border-collapse: collapse;
width: 100%;
}
+</style><link rel="stylesheet" href="mse.css">
+ <style>/*****************************************************************
+ * ReSpec 3 CSS
+ * Robin Berjon - http://berjon.com/
+ *****************************************************************/
+
+/* --- INLINES --- */
+em.rfc2119 {
+ text-transform: lowercase;
+ font-variant: small-caps;
+ font-style: normal;
+ color: #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+ border: none;
+}
+
+dfn {
+ font-weight: bold;
+}
+
+a.internalDFN {
+ color: inherit;
+ border-bottom: 1px solid #99c;
+ text-decoration: none;
+}
+
+a.externalDFN {
+ color: inherit;
+ border-bottom: 1px dotted #ccc;
+ text-decoration: none;
+}
+
+a.bibref {
+ text-decoration: none;
+}
+
+cite .bibref {
+ font-style: normal;
+}
+
+code {
+ color: #ff4500;
+}
+
+
+/* --- --- */
+ol.algorithm { counter-reset:numsection; list-style-type: none; }
+ol.algorithm li { margin: 0.5em 0; }
+ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }
+
+/* --- TOC --- */
+.toc a, .tof a {
+ text-decoration: none;
+}
+
+a .secno, a .figno {
+ color: #000;
+}
+
+ul.tof, ol.tof {
+ list-style: none outside none;
+}
+
+.caption {
+ margin-top: 0.5em;
+ font-style: italic;
+}
+
+/* --- TABLE --- */
+table.simple {
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-bottom: 3px solid #005a9c;
+}
+
+.simple th {
+ background: #005a9c;
+ color: #fff;
+ padding: 3px 5px;
+ text-align: left;
+}
+
+.simple th[scope="row"] {
+ background: inherit;
+ color: inherit;
+ border-top: 1px solid #ddd;
+}
+
+.simple td {
+ padding: 3px 10px;
+ border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+ background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+ margin-top: 0;
+}
+
+.section dd > p:last-child {
+ margin-bottom: 0;
+}
+
+.section dd {
+ margin-bottom: 1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+ margin-bottom: 0;
+}
</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
<body><div class="head">
<p>
@@ -429,7 +406,7 @@
</p>
<h1 class="title" id="title">Media Source Extensions</h1>
- <h2 id="w3c-editor-s-draft-29-october-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 29 October 2013</h2>
+ <h2 id="w3c-editor-s-draft-04-november-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 04 November 2013</h2>
<dl>
<dt>This version:</dt>
@@ -2765,7 +2742,7 @@
<section id="acknowledgements">
<!--OddPage--><h2><span class="secno">14. </span>Acknowledgments</h2>
- The editors would like to thank Alex Giladi, Bob Lund, Cyril Concolato, David Dorwin, David Singer, Duncan Rowden, Frank Galligan, Glenn Adams, Jerry Smith, Joe Steele, John Simmons, Kevin Streeter, Mark Vickers, Matt Ward, Michael Thornburgh, Philip Jägenstedt, Pierre Lemieux, Ralph Giles, Steven Robertson, and Tatsuya Igarashi for their contributions to this specification.
+ The editors would like to thank Alex Giladi, Bob Lund, Chris Poole, Cyril Concolato, David Dorwin, David Singer, Duncan Rowden, Frank Galligan, Glenn Adams, Jerry Smith, Joe Steele, John Simmons, Kevin Streeter, Mark Vickers, Matt Ward, Michael Thornburgh, Philip Jägenstedt, Pierre Lemieux, Ralph Giles, Steven Robertson, and Tatsuya Igarashi for their contributions to this specification.
</section>
<section id="revision-history">
@@ -3185,9 +3162,9 @@
</section>
-<form action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank" style="position: fixed; width: 10em; top: 1em; right: 1em; font-family: Tahoma, sans-serif; font-size: 11px; opacity: 0.8; text-align: right;">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form><section id="references" class="appendix"><!--OddPage--><h2><span class="secno">A. </span>References</h2><section id="informative-references"><h3><span class="secno">A.1 </span>Informative references</h3><dl class="bibliography"><dt id="bib-BCP47">[BCP47]</dt><dd>A. Phillips; M. Davis. <a href="http://tools.ietf.org/html/bcp47"><cite>Tags for Identifying Languages</cite></a>. September 2009. IETF Best Current Practice. URL: <a href="http://tools.ietf.org/html/bcp47">http://tools.ietf.org/html/bcp47</a>
+<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">A. </span>References</h2><section id="informative-references"><h3><span class="secno">A.1 </span>Informative references</h3><dl class="bibliography"><dt id="bib-BCP47">[BCP47]</dt><dd>A. Phillips; M. Davis. <a href="http://tools.ietf.org/html/bcp47"><cite>Tags for Identifying Languages</cite></a>. September 2009. IETF Best Current Practice. URL: <a href="http://tools.ietf.org/html/bcp47">http://tools.ietf.org/html/bcp47</a>
</dd><dt id="bib-FILE-API">[FILE-API]</dt><dd>Arun Ranganathan; Jonas Sicking. <a href="http://www.w3.org/TR/2012/WD-FileAPI-20121025"><cite>File API</cite></a>. 25 October 2012. W3C Working Draft. URL: <a href="http://www.w3.org/TR/2012/WD-FileAPI-20121025">http://www.w3.org/TR/2012/WD-FileAPI-20121025</a>
</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Robin Berjon et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 17 December 2012. W3C Candidate Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a>
</dd><dt id="bib-STREAMS-API">[STREAMS-API]</dt><dd>Feras Moussa. <a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm"><cite>Streams API</cite></a>. 25 October 2012. W3C Editor's Draft. URL: <a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm">http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm</a>
</dd><dt id="bib-TYPED-ARRAYS">[TYPED-ARRAYS]</dt><dd>David Herman, Kenneth Russell. <a href="https://www.khronos.org/registry/typedarray/specs/latest/"><cite>Typed Arrays</cite></a> Khronos Working Draft. (Work in progress.) URL: <a href="https://www.khronos.org/registry/typedarray/specs/latest/">https://www.khronos.org/registry/typedarray/specs/latest/</a>
-</dd></dl></section></section></body></html>
+</dd></dl></section></section><form action="//www.w3.org/Bugs/Public/enter_bug.cgi" target="_blank" style="position: fixed; width: 10em; top: 1em; right: 1em; font-family: Tahoma, sans-serif; font-size: 11px; opacity: 0.8; text-align: right;">See a problem? Select text and <input type="submit" accesskey="f" value="file a bug" style="font-family: Tahoma, sans-serif; font-size: 10px;"><input type="hidden" name="comment" value=""><input type="hidden" name="short_desc" value="[MSE] "><input type="hidden" name="product" value="HTML WG"><input type="hidden" name="component" value="Media Source Extensions">.</form></body></html>
--- a/media-source/media-source.js Thu Oct 31 14:59:50 2013 -0700
+++ b/media-source/media-source.js Mon Nov 04 11:16:03 2013 -0800
@@ -3,16 +3,23 @@
var DOM_spec_url = "http://dom.spec.whatwg.org/";
var HRTIME_spec_url = "http://www.w3.org/TR/hr-time/";
+ function url_helper(doc, url) {
+ if (url[0] == "#" && doc.mseDefGroupName != window.respecConfig.mseDefGroupName) {
+ return groupBaseURLs[doc.mseDefGroupName] + url;
+ }
+ return url;
+ }
+
function eventdfn_helper(doc, df, id, text) {
df.appendChild($("<dfn/>").attr({id: 'dom-evt-' + text.toLowerCase()}).wrapInner($("<code/>").text(text))[0]);
}
function idlref_helper(doc, df, id, text) {
- df.appendChild($("<code/>").wrapInner($("<a/>").attr({href: "#" + id}).text(text))[0]);
+ df.appendChild($("<code/>").wrapInner($("<a/>").attr({href: url_helper(doc, "#" + id)}).text(text))[0]);
}
function eventref_helper(doc, df, id, text) {
- df.appendChild($("<code/>").wrapInner($("<a/>").attr({href: "#dom-evt-" + id}).text(text))[0]);
+ df.appendChild($("<code/>").wrapInner($("<a/>").attr({href: url_helper(doc, "#dom-evt-" + id)}).text(text))[0]);
}
function videoref_helper(doc, df, id, text) {
@@ -31,7 +38,6 @@
link_helper(doc, df, HRTIME_spec_url + '#' + id, text);
}
-
function webappapis_helper(doc, df, id, text) {
link_helper(doc, df, 'http://www.w3.org/TR/html5/webappapis.html#' + id, text);
}
@@ -40,20 +46,20 @@
link_helper(doc, df, 'http://www.w3.org/TR/html5/infrastructure.html#' + id, text);
}
- function browsers_helper(doc, df, id, text) {
- link_helper(doc, df, 'http://www.w3.org/TR/html5/browsers.html#' + id, text);
+ function browsers_helper(doc, df, id, text) {
+ link_helper(doc, df, 'http://www.w3.org/TR/html5/browsers.html#' + id, text);
}
function term_helper(doc, df, id, text) {
- link_helper(doc, df, '#'+ id, text);
+ link_helper(doc, df, url_helper(doc, '#' + id), text);
}
function var_helper(doc, df, id, text) {
- df.appendChild($("<var/>").wrapInner($("<a/>").attr({href: id}).text(text))[0]);
+ df.appendChild($("<var/>").wrapInner($("<a/>").attr({href: url_helper(doc, id)}).text(text))[0]);
}
function link_helper(doc, df, id, text) {
- df.appendChild($("<a/>").attr({href: id}).text(text)[0]);
+ df.appendChild($("<a/>").attr({href: url_helper(doc, id)}).text(text)[0]);
}
function exception_helper(doc, df, id, text) {
@@ -89,29 +95,7 @@
}
function contributors_helper(doc, df, id, text) {
- var contributors = [
- "Bob Lund",
- "Alex Giladi",
- "Duncan Rowden",
- "Mark Vickers",
- "Glenn Adams",
- "Frank Galligan",
- "Steven Robertson",
- "Matt Ward",
- "David Dorwin",
- "Kevin Streeter",
- "Joe Steele",
- "Michael Thornburgh",
- "Philip Jägenstedt",
- "John Simmons",
- "Jerry Smith",
- "Pierre Lemieux",
- "Cyril Concolato",
- "Ralph Giles",
- "David Singer",
- "Tatsuya Igarashi",
- ];
-
+ var contributors = window.respecConfig.mseContributors;
contributors.sort();
var str = "";
@@ -134,7 +118,7 @@
idlref_helper(doc, df, 'idl-def-EndOfStreamError.decode', '"decode"');
}
- var rep = {
+ var mseDefinitions = {
'sourceBuffers': { func: idlref_helper, fragment: 'widl-MediaSource-sourceBuffers', link_text: 'sourceBuffers', },
'activeSourceBuffers': { func: idlref_helper, fragment: 'widl-MediaSource-activeSourceBuffers', link_text: 'activeSourceBuffers', },
'addSourceBuffer': { func: idlref_helper, fragment: 'widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type', link_text: 'addSourceBuffer()', },
@@ -359,6 +343,24 @@
'performance-now': { func: hrtime_helper, fragment: 'dom-performance-now', link_text: 'Performance.now()', },
};
+ var definitionInfo = {};
+ var groupBaseURLs = {};
+
+ function mediaSourceAddDefinitionInfo(groupName, groupBaseURL, definitions) {
+ groupBaseURLs[groupName] = groupBaseURL;
+ for (var def_id in definitions) {
+ if (definitionInfo[def_id]) {
+ console.log("Overriding previous definition of def-id '" + def_id + "'.");
+ }
+ var info = definitions[def_id];
+ info.groupName = groupName;
+ if (!info.func) {
+ info.func = link_helper;
+ }
+ definitionInfo[def_id] = info;
+ }
+ }
+
function mediaSourcePreProcessor() {
$("a[def-id]").each(function () {
$(this).addClass('externalDFN');
@@ -374,7 +376,7 @@
$("a[def-id]").each(function () {
var $ant = $(this);
var def_id = $ant.attr('def-id');
- var info = rep[def_id];
+ var info = definitionInfo[def_id];
if (info) {
if (!usedMap[def_id]) {
usedMap[def_id] = 1;
@@ -395,7 +397,9 @@
}
var df = doc.createDocumentFragment();
+ doc.mseDefGroupName = info.groupName;
info.func(doc, df, id, text);
+ doc.mseDefGroupName = "";
this.parentNode.replaceChild(df, this);
} else {
@@ -460,9 +464,11 @@
});
// Validate that all defined def-ids are actually used.
- for (var k in rep) {
- if (!usedMap[k]) {
- console.log("def-id '" + k + "' never used.");
+ var excludeList = window.respecConfig.mseUnusedGroupNameExcludeList || [];
+ for (var k in definitionInfo) {
+ var defGroupName = definitionInfo[k].groupName;
+ if (!usedMap[k] && !(excludeList.indexOf(defGroupName) != -1)) {
+ console.log("def-id '" + k + "' from groupName '" + defGroupName + "' never used.");
}
}
@@ -481,6 +487,9 @@
return;
}
+ mediaSourceAddDefinitionInfo("media-source", "http://www.w3.org/TR/media-source/", mseDefinitions);
+
+ window.mediaSourceAddDefinitionInfo = mediaSourceAddDefinitionInfo;
window.mediaSourcePreProcessor = mediaSourcePreProcessor;
window.mediaSourcePostProcessor = mediaSourcePostProcessor;
})();
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/media-source/mse.css Mon Nov 04 11:16:03 2013 -0800
@@ -0,0 +1,23 @@
+.nonnormative { color: green; margin: 2em 0 2em 0em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
+.nonnormative h3 { color: inherit; background: inherit; }
+.nonnormative:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This section is non-normative.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
+
+.iso-box { font-weight: bold; }
+.iso-var { font-style: italic; }
+
+table.old-table { border-collapse: collapse; border-style: hidden hidden none hidden; }
+table.old-table thead, table tbody { border-bottom: solid; }
+table.old-table tbody th:first-child { border-left: solid; }
+table.old-table tbody th { text-align: left; }
+table.old-table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
+
+dl.switch { padding-left: 2em; }
+dl.switch > dt { text-indent: -1.5em; }
+dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
+
+p + * > li, dd li { margin: 1em 0; }
+
+@media screen { code :link, code :visited { color: inherit; } }
+
+/* fix bug entry form styling */
+body > form { padding: 4px; border: 1px solid red; background-color: white; }