summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-05-06 21:56:21 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-05-06 21:56:21 -0400
commit9da5a59401ba850ea0fdb4a6c116dbdb0a183a5c (patch)
tree011053dee731e86252d1070154d8fd4c3850a191
parenta26bca9638a5fe77f5e833738386e6805a177744 (diff)
downloadaskbot-9da5a59401ba850ea0fdb4a6c116dbdb0a183a5c.tar.gz
askbot-9da5a59401ba850ea0fdb4a6c116dbdb0a183a5c.tar.bz2
askbot-9da5a59401ba850ea0fdb4a6c116dbdb0a183a5c.zip
fixed IE8 issues in the editor and on the question page
-rw-r--r--askbot/media/js/wmd/wmd.js21
-rw-r--r--askbot/templates/question.html6
2 files changed, 13 insertions, 14 deletions
diff --git a/askbot/media/js/wmd/wmd.js b/askbot/media/js/wmd/wmd.js
index c3c85b21..35a571e5 100644
--- a/askbot/media/js/wmd/wmd.js
+++ b/askbot/media/js/wmd/wmd.js
@@ -452,8 +452,7 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
if (input.type == 'text' && input.selectionStart !== undefined) {
input.selectionStart = 0;
input.selectionEnd = defTextLen;
- }
- else if (input.createTextRange) {
+ } else if (input.createTextRange) {
var range = input.createTextRange();
range.collapse(false);
range.moveStart("character", -defTextLen);
@@ -494,30 +493,26 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
var innerWidth, innerHeight;
// It's not very clear which blocks work with which browsers.
- if(self.innerHeight && self.scrollMaxY){
+ if (self.innerHeight && self.scrollMaxY) {
scrollWidth = doc.body.scrollWidth;
scrollHeight = self.innerHeight + self.scrollMaxY;
- }
- else if(doc.body.scrollHeight > doc.body.offsetHeight){
+ } else if (doc.body.scrollHeight > doc.body.offsetHeight){
scrollWidth = doc.body.scrollWidth;
scrollHeight = doc.body.scrollHeight;
- }
- else{
+ } else {
scrollWidth = doc.body.offsetWidth;
scrollHeight = doc.body.offsetHeight;
}
- if(self.innerHeight){
+ if (self.innerHeight) {
// Non-IE browser
innerWidth = self.innerWidth;
innerHeight = self.innerHeight;
- }
- else if(doc.documentElement && doc.documentElement.clientHeight){
+ } else if (doc.documentElement && doc.documentElement.clientHeight){
// Some versions of IE (IE 6 w/ a DOCTYPE declaration)
innerWidth = doc.documentElement.clientWidth;
innerHeight = doc.documentElement.clientHeight;
- }
- else if(doc.body){
+ } else if(doc.body) {
// Other versions of IE
innerWidth = doc.body.clientWidth;
innerHeight = doc.body.clientHeight;
@@ -1950,7 +1945,7 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
var result = 0;
- if (innerHeight) {
+ if (window.innerHeight) {
result = pageYOffset;
}
else
diff --git a/askbot/templates/question.html b/askbot/templates/question.html
index 9a508a2f..a8aef0a7 100644
--- a/askbot/templates/question.html
+++ b/askbot/templates/question.html
@@ -43,6 +43,10 @@
return nodes;
};
+ var getTextContent = function(node) {
+ return node.innerText || node.textContent;
+ };
+
var hasAttribute = function(node, attrName) {
if (node.hasAttribute) {
return node.hasAttribute(attrName);
@@ -139,7 +143,7 @@
//todo: this is not reliable
var answerBodyNodes = answerBody.childNodes;
var answerElement = answerBodyNodes[answerBodyNodes.length - 1];
- if (trim(answerElement.textContent).length > askbot['data']['maxCommentLength']) {
+ if (trim(getTextContent(answerElement)).length > askbot['data']['maxCommentLength']) {
repostAsQuestionComment.parentNode.removeChild(repostAsQuestionComment);
repostAsPrevAnsComment.parentNode.removeChild(repostAsPrevAnsComment);
} else if (parseInt(post_id) === data['oldestAnswerId']) {