Skip to content

Commit

Permalink
more fixes for ticket 142. Done from clean checkout, all tests pass. …
Browse files Browse the repository at this point in the history
…Nothing major changed (add semicolon, move functions to top, etc). git diff -w maybe more useful on some files, as they were contaminated with tabs.
  • Loading branch information
nickg committed Mar 29, 2010
1 parent 7879a69 commit 249158e
Show file tree
Hide file tree
Showing 12 changed files with 290 additions and 280 deletions.
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -234,9 +234,9 @@
<fileset dir="${SRC_DIR}" includes="common/intro.js" />
<fileset dir="${SRC_DIR}" includes="common/__extend__.js" />
<fileset dir="${SRC_DIR}" includes="common/__setArray__.js" />
<fileset dir="${SRC_DIR}" includes="dom/node.js" />
<fileset dir="${SRC_DIR}" includes="dom/nodelist.js" />
<fileset dir="${SRC_DIR}" includes="dom/namednodemap.js" />
<fileset dir="${SRC_DIR}" includes="dom/node.js" />
<fileset dir="${SRC_DIR}" includes="dom/namespace.js" />
<fileset dir="${SRC_DIR}" includes="dom/characterdata.js" />
<fileset dir="${SRC_DIR}" includes="dom/text.js" />
Expand Down
47 changes: 26 additions & 21 deletions src/console/console.js
Expand Up @@ -30,7 +30,7 @@ Console = function(module){
logFormatted(arguments, (module)+" error");
}
};
}else{
} else {
$logger = {
log: function(level){
logFormatted(arguments, "");
Expand Down Expand Up @@ -69,19 +69,21 @@ function logFormatted(objects, className)
var object = objects[++objIndex];
part.appender(object, html);
}
else
else {
appendText(part, html);
}
}

for (var i = objIndex+1; i < objects.length; ++i)
{
appendText(" ", html);

var object = objects[i];
if (typeof(object) == "string")
if (typeof(object) == "string") {
appendText(object, html);
else
} else {
appendObject(object, html);
}
}

Envjs.log(html.join(' '));
Expand Down Expand Up @@ -167,22 +169,23 @@ function appendObject(object, html)
{
try
{
if (object == undefined)
if (object == undefined) {
appendNull("undefined", html);
else if (object == null)
} else if (object == null) {
appendNull("null", html);
else if (typeof object == "string")
} else if (typeof object == "string") {
appendString(object, html);
else if (typeof object == "number")
} else if (typeof object == "number") {
appendInteger(object, html);
else if (typeof object == "function")
} else if (typeof object == "function") {
appendFunction(object, html);
else if (object.nodeType == 1)
} else if (object.nodeType == 1) {
appendSelector(object, html);
else if (typeof object == "object")
} else if (typeof object == "object") {
appendObjectFormatted(object, html);
else
} else {
appendText(object, html);
}
}
catch (exc)
{
Expand All @@ -195,18 +198,19 @@ function appendObjectFormatted(object, html)
var reObject = /\[object (.*?)\]/;

var m = reObject.exec(text);
html.push( m ? m[1] : text)
html.push( m ? m[1] : text);
}

function appendSelector(object, html)
{

html.push(escapeHTML(object.nodeName.toLowerCase()));
if (object.id)
if (object.id) {
html.push(escapeHTML(object.id));
if (object.className)
}
if (object.className) {
html.push(escapeHTML(object.className));

}
}

function appendNode(node, html)
Expand All @@ -218,23 +222,24 @@ function appendNode(node, html)
for (var i = 0; i < node.attributes.length; ++i)
{
var attr = node.attributes[i];
if (!attr.specified)
if (!attr.specified) {
continue;
}

html.push( attr.nodeName.toLowerCase(),escapeHTML(attr.nodeValue))
html.push( attr.nodeName.toLowerCase(),escapeHTML(attr.nodeValue));
}

if (node.firstChild)
{
for (var child = node.firstChild; child; child = child.nextSibling)
for (var child = node.firstChild; child; child = child.nextSibling) {
appendNode(child, html);
}

html.push( node.nodeName.toLowerCase());
}
}
else if (node.nodeType == 3)
else if (node.nodeType === 3)
{
html.push(escapeHTML(node.nodeValue));
}
};

0 comments on commit 249158e

Please sign in to comment.