A short comment on Post Preview.

Started by
0 comments, last by konForce 18 years, 7 months ago
I like the show preview feature, but it doesn't always give an accurate preview. For example, the code

int n = 3142;
int * pointer = new int[n + 1];

shows up as

int n = 3142;
int * pointer = new int[n   1];

in the preview window. Does anyone else experience similar problems? Also, I find it mildy irritating the way it highlights keywords:

int VOID = 0, STATIC_CAST = 4;
typedef int INT;
INT CLASS = VOID + STATIC_CAST;

[looksaround]
Advertisement
I would assume it is because they are not aware of "encodeURIComponent()" and are using "escape()" instead.

This probably fixes it*:

	    if (window.XMLHttpRequest) {	        req = new XMLHttpRequest();	        req.onreadystatechange = processReqChange;			req.open("POST", "postpreview.asp", true);			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	        req.send("msg=" + encodeURIComponent(document.PostTopic.message.value));	    // branch for IE/Windows ActiveX version	    } else if (window.ActiveXObject) {	        isIE = true;	        req = new ActiveXObject("Microsoft.XMLHTTP");	        if (req) {	            req.onreadystatechange = processReqChange;	            req.open("POST", "postpreview.asp", true);				req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	            req.send("msg=" + encodeURIComponent(document.PostTopic.message.value));	        }	    }  


* I just searched for "escape" in the source, I didn't actually try to follow what was going on.

I think 5.5 was the first IE version it showed up in. One could always do:
if (!encodeURIComponent) encodeURIComponent = escape;

if they really wanted to "support" people who live in the dark ages...

This topic is closed to new replies.

Advertisement