CKEditor, IE9 and JavaScript - javascript

I am using the latest version of CKEditor (CKEditor 3.6.3, released on 17 April 2012) on my site.
It works perfectly in Firefox, Chrome and IE9 without any modification.
It works perfectly in Firefox and Chrome when I customize the toolbar, but then I get the following error message (I translated it) in IE9:
"SCRIPT5007: Cannot retrieve the value of property length, the object is null or undefined.
ckeditor.js, line 11101 token 21"
And that is the following line:
var w=o.toolbox.toolbars,x=o.config.toolbar instanceof Array ? o.config.toolbar : o.config['toolbar_'+o.config.toolbar];
for(var y=0;y<x.length;y++){
So somehow the variable x is not an Array in IE9: I've tried IE7, 8 and 9 various modes all have the same error.
And it seems that IE9 is also the only browser that does not execute the following line:
CKEDITOR.editorConfig = function( config ) {}
Is this a familiar problem (if so, how can I fix it) or is it a bug in CKEditor?

If your configuration you have a syntax error, for example a trailing comma.

Related

Simple string.replace() is failing for javascript in Microsoft Edge

I have microsoft edge version 40, it is really old but I can't update my Edge without updating my W10 OS, and thats like 4 gigs or something and I don't have the SSD space to spare. Plus there are reports this is happening on the newer versions too.
Anyway here is the following code that causes the error:
varvalue = varvalue.replace("'", '');
varvalue = varvalue.replace('"', '');
And when I'm on edge I get this error in the console works in all other browsers including IE:
Unhandled promise rejection TypeError: Object doesn't support property or method 'replace'
When I comment out the code causing the error, it goes away and everything is fine, so I KNOW that it is these lines causing the issue. Only for Microsoft Edge though.
Basically I'm checking if varvalue contains either an apostrophe or double apostrophe (which it usually will for whatever reason) then it needs to be stripped out of the string, so I'm just looking for any of those in the string and removing them.
It appears that Edge does not think varvalue is a string, but rather an object.
This is probably caused by the method in which it receives the data, and not these replace functions.

new Websocket() return wrong object in Firefox Quantum

I'm using Firefox Quantum (64.0) and the JS command new WebSocket() returns a different object from the specification:
MDN Websocket
HTML Standard
The missing property that is affecting my appllication is the .close() function, but there is another differences.
You can see in the image bellow that the returned object has a .websocket porperty that contains all the missing ones.
websocket object
Am I doing something wrong? With older versions of Firefox (before Quantum, like 43) or with chrome it works fine.
If it is a problem with firefox, how can I report it?
EDIT:
Adding some code example:
var exampleSocket = new WebSocket("wss://echo.websocket.org");
exampleSocket.close() // Throw "exampleSocket.close is not a function" in Firefox Quantum, works on chrome
exampleSocket.websocket.close() // Works on Firefox, Throw on chrome.
This exampleSocket.websocket is not in the documentation.
Edit2:
I tested in other machines that have the firefox versions 60, 61, 63 and 64 and the problem only happened in my machine.
When I removed all plugins from firefox it started to work again.
The problem was the websocketsniff plugin that I had installed.
It even state that the WebSocket object will change:
Inspect websocket frames in Firefox. How to use: 1) Open Developer
Tools 2) Open "Websocket Sniffer" tab
This extension replace native websocket object for custom object. It
is dirty hack, but it is single decision

Default parameter behaviour in Firefox and Chrome

So I was fiddling around with function overloading (I believe thats the correct term for this). Heres what happened:
function example(a=3,b=6){
console.log(a);
console.log(b);
}
In firefox, this did exactly what I expected.
example()
3
6
example(17)
17
6
example(10,20)
10
20
However, when I tried this in the console in Chrome, it failed to even create the function. I got error
SyntaxError: Unexpected token =
Why is this happening?
Default values to functions are part of ECMA Script 6 specifications. You might be using the latest version of FireFox in which they would have implemented it.
All the browsers which havn't implemented the ES6 specifications won't be able to parse the expression. That is why it is failing.
You can check Kangax's compatibility table to know where your browser supports it or not.

Method compareDocumentPosition unsupported only in IE9

In one of my web pages, I am using the following line of JavaScript:
return !!(a.compareDocumentPosition(b) & 16);
However, only in IE9, I am getting the following error:
Object doesn't support property or method 'compareDocumentPosition'
Other browsers work fine. Does anyone know of an available fix or workaround for this?
Internet Explorer supports compareDocumentPosition only in IE9 mode. Make sure you have at the beginning of your markup and document.documentMode returns 9

My IE9 is fine with trailing comma, user's IE9 is not; why?

I have a web app with a JavaScript file using code like the following:
var foo = {a:'b',c:'d',e:'f',};
On my computer, IE9 (9.0.8112.16421) works correctly; the JavaScript is parsed and executed as on Chrome/FF/Safari. Another user claims to have the same version of IE, yet gets this error in the Developer Tools Console:
SCRIPT1028: Expected identifier, string or number
blob.js?modified=1304026278, line 524 character 136
Column 136 is the trailing comma/closing brace for the object literal.
I've 'fixed' the code so the user should have no more problems, but I'm wondering:
What could make the same version of IE on two different computers treat the JavaScript differently?
One of the reasons may be that user has pressed the "Compatibility View" button. The trailing comma causes syntax error in IE7 document mode.
Its most likely due to a browser setting suppressing the error on your browser.

Categories