From f841c17eeb1c7b53a49ca3f2bb25fa540757c8a6 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 24 Jan 2009 23:56:28 -0800 Subject: [PATCH] Apparently 'node.tagName == "FOO"' will throw if tagName is undefined. --- static/js/Editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index b328c04..c992f8f 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -450,7 +450,8 @@ Editor.prototype.position_cursor = function ( div_range ) { else var range = this.document.createRange(); - while ( ( last_node.nodeValue == "\n" || last_node.tagName == "BR" ) && last_node.previousSibling ) + while ( ( last_node.nodeValue == "\n" || ( last_node.tagName && last_node.tagName == "BR" ) ) && + last_node.previousSibling ) last_node = last_node.previousSibling; range.selectNodeContents( last_node );