From 7f50a8ea9e47b57a5fc348c36983869d94b39011 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 10 Apr 2014 09:37:33 +0300 Subject: [PATCH] Tweak CSSLintDemo. --- demos/CSSLintDemo.htm | 9 +++++---- demos/demo.js | 41 ++++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/demos/CSSLintDemo.htm b/demos/CSSLintDemo.htm index 0c72b847..89b5bd34 100644 --- a/demos/CSSLintDemo.htm +++ b/demos/CSSLintDemo.htm @@ -8,11 +8,12 @@ .error { color: #D9534F; font-weight: bold; } .warning { color: #F0AD4E; } - + +

CSSLint Demo

- - +
+

(You may want to keep the CSS kinda small, this could take a while.)

- diff --git a/demos/demo.js b/demos/demo.js index ab0a623d..51ac47b9 100644 --- a/demos/demo.js +++ b/demos/demo.js @@ -1,28 +1,31 @@ /* jshint browser:true */ (function() { + "use strict"; - document.body.onclick = function(event) { - event = event || window.event; - var target = event.target || event.srcElement, - results, - messages, - i, - len; + window.onload = function() { + document.body.onclick = function(event) { + event = event || window.event; + var target = event.target || event.srcElement, + results, + messages, + i, + len; + function log(value, level) { + var output = document.getElementById("output"); + output.innerHTML += "" + value.replace(/ /g, " ") + "
"; + } + + if (target.id === "lint-btn") { + document.getElementById("output").innerHTML = ""; + results = CSSLint.verify(document.getElementById("input").value); + messages = results.messages; + for (i=0, len=messages.length; i < len; i++) { + log(messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type); + } - if (target.id == "lint-btn") { - document.getElementById("output").innerHTML = ""; - results = CSSLint.verify(document.getElementById("input").value); - messages = results.messages; - for (i=0, len=messages.length; i < len; i++) { - log(messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type); } - } + }; }; - - function log(value, level) { - var output = document.getElementById("output"); - output.innerHTML += "" + value.replace(/ /g, " ") + "
"; - } })();