diff --git a/docs/demo/demo.js b/docs/demo/demo.js
index 2e5198adb3..de6882a5be 100644
--- a/docs/demo/demo.js
+++ b/docs/demo/demo.js
@@ -80,7 +80,7 @@ Promise.all([
});
function setInitialText() {
- if (search.text) {
+ if ('text' in search) {
$markdownElem.value = search.text;
} else {
return fetch('./initial.md')
@@ -148,7 +148,7 @@ function setInitialVersion() {
}
function setInitialOptions() {
- if (search.options) {
+ if ('options' in search) {
$optionsElem.value = search.options;
} else {
setDefaultOptions();
diff --git a/docs/demo/index.html b/docs/demo/index.html
index 7d21663695..96a8ec14b1 100644
--- a/docs/demo/index.html
+++ b/docs/demo/index.html
@@ -58,7 +58,7 @@
Marked Demo
-
+
diff --git a/docs/demo/initial.md b/docs/demo/initial.md
index 2465aef041..d2b7d77c10 100644
--- a/docs/demo/initial.md
+++ b/docs/demo/initial.md
@@ -30,7 +30,7 @@ It's easy. It's not overly bloated, unlike HTML. Also, as the creator of [mark
> or formatting instructions.
Ready to start writing? Either start changing stuff on the left or
-[clear everything](?text=) with a simple click.
+[clear everything](/demo/?text=) with a simple click.
[Marked]: https://github.com/markedjs/marked/
[Markdown]: http://daringfireball.net/projects/markdown/
diff --git a/docs/demo/worker.js b/docs/demo/worker.js
index cb189390aa..06b8befe78 100644
--- a/docs/demo/worker.js
+++ b/docs/demo/worker.js
@@ -83,7 +83,7 @@ function jsonString(input) {
function loadVersion(ver) {
var promise;
- if (ver in versionCache) {
+ if (versionCache[ver]) {
promise = Promise.resolve(versionCache[ver]);
} else {
promise = fetch(ver)