From 21285cf929cd8f70c3d70a8df7e2895f7041fe67 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Sun, 8 Jan 2012 19:17:50 -0500 Subject: [PATCH] Firefox compatibility --- experimental/palette/index.html | 2 -- experimental/palette/index.js | 4 ++-- experimental/palette/palette.css | 6 ++++++ experimental/palette/palette.js | 18 +++++++++++------- experimental/palette/tooltip.js | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/experimental/palette/index.html b/experimental/palette/index.html index b3a3218..ced58a9 100644 --- a/experimental/palette/index.html +++ b/experimental/palette/index.html @@ -14,8 +14,6 @@ -

Palette

diff --git a/experimental/palette/index.js b/experimental/palette/index.js index 8f9491e..602bde4 100644 --- a/experimental/palette/index.js +++ b/experimental/palette/index.js @@ -58,7 +58,7 @@ Index.draw = function(element, data, options) { Index.addMessage = function(text) { var messages = document.getElementById("messages"); - messages.innerText = messages.innerText + text + "\n"; + messages.textContent = messages.textContent + text + "\n"; } Index.start = function() { @@ -79,7 +79,7 @@ Index.start = function() { var entry = Samples.data[idx]; var option = document.createElement("option"); option.value = entry.id; - option.innerText = entry.title; + option.textContent = entry.title; selector.appendChild(option); } selector.onchange = function() { diff --git a/experimental/palette/palette.css b/experimental/palette/palette.css index a0c4f1f..b5b6b79 100644 --- a/experimental/palette/palette.css +++ b/experimental/palette/palette.css @@ -31,6 +31,12 @@ .palette .option { } +.palette .textInput { + padding: 1px; + border: 2px inset; + border-color: #EEE; +} + .tooltip { position: absolute; border: 1px solid black; diff --git a/experimental/palette/palette.js b/experimental/palette/palette.js index 1e718f4..d7c7cab 100644 --- a/experimental/palette/palette.js +++ b/experimental/palette/palette.js @@ -51,7 +51,7 @@ Palette.prototype.create = function(document, parentElement) { var row = Palette.createChild("div", table, "header"); row.style.visibility = "visible"; - Palette.createChild("span", row).innerText = "Filter:"; + Palette.createChild("span", row).textContent = "Filter:"; this.filterBar = Palette.createChild("input", Palette.createChild("span", row)); this.filterBar.type = "search"; this.filterBar.onkeyup = function() { @@ -59,14 +59,14 @@ Palette.prototype.create = function(document, parentElement) { }; this.filterBar.onclick = this.filterBar.onkeyup; var go = Palette.createChild("button", Palette.createChild("span", row)); - go.innerText = "Redraw" + go.textContent = "Redraw" go.onclick = function() { palette.onchange(); }; // CURRENTLY HIDDEN. var tmp = Palette.createChild("button", Palette.createChild("span", row)); - tmp.innerText = "Copy" + tmp.textContent = "Copy" tmp.onclick = function() { var textarea = new TextArea(); textarea.show("header", "Now is the time for all good men\nto come to the aid of their country"); @@ -87,7 +87,7 @@ Palette.prototype.create = function(document, parentElement) { row.onmouseout = function() { palette.tooltip.hide(); }; var div = Palette.createChild("span", row, "name"); - div.innerText = opt; + div.textContent = opt; var value = Palette.createChild("span", row, "option"); @@ -105,14 +105,18 @@ Palette.prototype.create = function(document, parentElement) { textarea.okCallback = function(value) { if (value != inputValue) { entry.functionString = value; - entry.input.innerText = value ? "defined" : "not defined"; + entry.input.textContent = value ? "defined" : "not defined"; palette.onchange(); } } } }(opt, this); } else { - var input = Palette.createChild("input", value); + var input = Palette.createChild("input", value, "textInput"); + if (type == "boolean") { + input.size = "5"; + input.maxlength = "5"; + } input.onkeypress = function(event) { var keycode = event.which; if (keycode == 13 || keycode == 8) { @@ -216,7 +220,7 @@ Palette.prototype.write = function(hash) { input.value = value.join(", "); } } else if (type.indexOf("function(") == 0) { - input.innerText = value ? "defined" : "not defined"; + input.textContent = value ? "defined" : "not defined"; this.model[opt].functionString = value ? value.toString() : null; } else { if (value) { diff --git a/experimental/palette/tooltip.js b/experimental/palette/tooltip.js index 6ceb16e..5014934 100644 --- a/experimental/palette/tooltip.js +++ b/experimental/palette/tooltip.js @@ -43,7 +43,7 @@ function Tooltip(parent) { Tooltip.prototype.show = function(source, event, title, type, body) { this.title.innerHTML = title; this.body.innerHTML = body; - this.type.innerText = type; // innerText for arrays. + this.type.textContent = type; // textContent for arrays. var getTopLeft = function(element) { var x = element.offsetLeft; -- 2.7.4