Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
npm run build
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 17, 2016
1 parent 9c441f7 commit 7d8e9d9
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 22 deletions.
55 changes: 44 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,39 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="./spec.js"></script>
<title>String.prototype.padStart / padEnd</title>
<script type="application/json" id="menu-search-biblio">{"clauses":{"String.prototype.padStart":{"location":"","id":"String.prototype.padStart","aoid":null,"title":"String.prototype.padStart( maxLength [ , fillString ] )","number":"1"},"String.prototype.padEnd":{"location":"","id":"String.prototype.padEnd","aoid":null,"title":"String.prototype.padEnd( maxLength [ , fillString ] )","number":"2"},"sec-copyright-and-software-license":{"location":"","id":"sec-copyright-and-software-license","aoid":null,"title":"Copyright & Software License","number":"A"}},"ops":{},"productions":{},"terms":{},"examples":{},"notes":{},"tables":{},"figures":{}}</script>
<script type="application/json" id="menu-search-biblio">
[{
"type": "clause",
"id": "String.prototype.padStart",
"aoid": null,
"title": "String.prototype.padStart( maxLength [ , fillString ] )",
"number": "1",
"location": "",
"key": "String.prototype.padStart( maxLength [ , fillString ] )"
}, {
"type": "clause",
"id": "String.prototype.padEnd",
"aoid": null,
"title": "String.prototype.padEnd( maxLength [ , fillString ] )",
"number": "2",
"location": "",
"key": "String.prototype.padEnd( maxLength [ , fillString ] )"
}, {
"type": "clause",
"id": "sec-copyright-and-software-license",
"aoid": null,
"title": "Copyright & Software License",
"number": "A",
"location": "",
"key": "Copyright & Software License"
}]
</script>
</head>

<body>
<div id="menu-toggle">☰</div>
<div id="menu">
<div id="menu-search">
<input type="text" id="menu-search-box" placeholder="Search...">
<div id="menu-search"><input type="text" id="menu-search-box" placeholder="Search...">
<div id="menu-search-results" class="inactive"></div>
</div>
<div id="menu-toc">
Expand All @@ -31,15 +56,19 @@ <h1><span class="secnum">1</span>String.prototype.padStart( maxLength [ , fillSt
<p>When the <code>padStart</code> method is called, the following steps are taken:</p>
<emu-alg>
<ol>
<li>Let <var>O</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-requireobjectcoercible">RequireObjectCoercible</a>(
<li>Let <var>O</var> be ?
<emu-xref aoid="RequireObjectCoercible"><a href="https://tc39.github.io/ecma262#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(
<emu-val>this</emu-val> value).</li>
<li>Let <var>S</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-tostring">ToString</a>(<var>O</var>).</li>
<li>Let <var>intMaxLength</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-tolength">ToLength</a>(<var>maxLength</var>).</li>
<li>Let <var>S</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>O</var>).</li>
<li>Let <var>intMaxLength</var> be ?
<emu-xref aoid="ToLength"><a href="https://tc39.github.io/ecma262#sec-tolength">ToLength</a></emu-xref>(<var>maxLength</var>).</li>
<li>Let <var>stringLength</var> be the number of elements in S.</li>
<li>If <var>intMaxLength</var> is not greater than <var>stringLength</var>, return <var>S</var>.</li>
<li>If <var>fillString</var> is
<emu-val>undefined</emu-val>, let <var>filler</var> be the empty String.</li>
<li>Else, let <var>filler</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-tostring">ToString</a>(<var>fillString</var>).</li>
<li>Else, let <var>filler</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>fillString</var>).</li>
<li>If <var>filler</var> is the empty String, let <var>filler</var> be a string consisting solely of the code unit U+0020 (SPACE).</li>
<li>Let <var>fillLen</var> be <var>intMaxLength</var> - <var>stringLength</var>.</li>
<li>Let <var>truncatedStringFiller</var> be a new String value consisting of repeated concatenations of <var>filler</var> truncated to length <var>fillLen</var>.</li>
Expand All @@ -59,15 +88,19 @@ <h1><span class="secnum">2</span>String.prototype.padEnd( maxLength [ , fillStri
<p>When the <code>padEnd</code> method is called, the following steps are taken:</p>
<emu-alg>
<ol>
<li>Let <var>O</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-requireobjectcoercible">RequireObjectCoercible</a>(
<li>Let <var>O</var> be ?
<emu-xref aoid="RequireObjectCoercible"><a href="https://tc39.github.io/ecma262#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(
<emu-val>this</emu-val> value).</li>
<li>Let <var>S</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-tostring">ToString</a>(<var>O</var>).</li>
<li>Let <var>intMaxLength</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-tolength">ToLength</a>(<var>maxLength</var>).</li>
<li>Let <var>S</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>O</var>).</li>
<li>Let <var>intMaxLength</var> be ?
<emu-xref aoid="ToLength"><a href="https://tc39.github.io/ecma262#sec-tolength">ToLength</a></emu-xref>(<var>maxLength</var>).</li>
<li>Let <var>stringLength</var> be the number of elements in S.</li>
<li>If <var>intMaxLength</var> is not greater than <var>stringLength</var>, return <var>S</var>.</li>
<li>If <var>fillString</var> is
<emu-val>undefined</emu-val>, let <var>filler</var> be the empty String.</li>
<li>Else, let <var>filler</var> be ? <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-tostring">ToString</a>(<var>fillString</var>).</li>
<li>Else, let <var>filler</var> be ?
<emu-xref aoid="ToString"><a href="https://tc39.github.io/ecma262#sec-tostring">ToString</a></emu-xref>(<var>fillString</var>).</li>
<li>If <var>filler</var> is the empty String, let <var>filler</var> be a string consisting solely of the code unit U+0020 (SPACE).</li>
<li>Let <var>fillLen</var> be <var>intMaxLength</var> - <var>stringLength</var>.</li>
<li>Let <var>truncatedStringFiller</var> be a new String value consisting of repeated concatenations of <var>filler</var> truncated to length <var>fillLen</var>.</li>
Expand Down
6 changes: 6 additions & 0 deletions spec.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ emu-eqn div:first-child {
margin-left: -2em;
}

emu-eqn.inline {
display: inline;
margin: 0;
white-space: nowrap;
}

emu-note {
display: block;
margin: 1em 0 1em 6em;
Expand Down
20 changes: 9 additions & 11 deletions spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Menu.prototype.initSearch = function () {
this.biblio = JSON.parse($biblio.textContent);
}

this.biblio.ops = this.biblio.filter(function (e) { return e.type === 'op' });
this.biblio.clauses = this.biblio.filter(function (e) { return e.type === 'clause' });
this.biblio.productions = this.biblio.filter(function (e) { return e.type === 'production' });

document.addEventListener('keydown', function (e) {
if (e.keyCode === 191) {
e.preventDefault();
Expand Down Expand Up @@ -99,25 +103,19 @@ Menu.prototype.search = function (needle) {
var results = {};
var seenClauses = {};

results.ops = Object.keys(this.biblio.ops).map(function (k) {
return this.biblio.ops[k];
}.bind(this)).filter(function(op) {
results.ops = this.biblio.ops.filter(function(op) {
return fuzzysearch(needle, op.aoid.toLowerCase());
});

results.ops.forEach(function(op) {
seenClauses[op.id] = true;
seenClauses[op.refId] = true;
});

results.productions = Object.keys(this.biblio.productions).map(function (k) {
return this.biblio.productions[k];
}.bind(this)).filter(function(prod) {
results.productions = this.biblio.productions.filter(function(prod) {
return fuzzysearch(needle, prod.name.toLowerCase());
});

results.clauses = Object.keys(this.biblio.clauses).map(function (k) {
return this.biblio.clauses[k];
}.bind(this)).filter(function(clause) {
results.clauses = this.biblio.clauses.filter(function(clause) {
return !seenClauses[clause.id] && (clause.number.indexOf(needle) === 0 || fuzzysearch(needle, clause.title.toLowerCase()));
});

Expand All @@ -137,7 +135,7 @@ Menu.prototype.displayResults = function (results) {
var html = '<ul>';

results.ops.forEach(function (op) {
html += '<li class=menu-search-result-op><a href="#' + op.id + '">' + op.aoid + '</a></li>'
html += '<li class=menu-search-result-op><a href="#' + op.refId + '">' + op.aoid + '</a></li>'
});

results.productions.forEach(function (prod) {
Expand Down

0 comments on commit 7d8e9d9

Please sign in to comment.