Opened 12 years ago

Closed 10 years ago

#8659 closed Bug (fixed)

SCAYT + SyntaxHighlighter conflict

Reported by: Anna Tomanek Owned by:
Priority: Normal Milestone:
Component: UI : Spell Checker Version: 3.0
Keywords: Cc:


As reported in:

On a page which uses Alex Gorbatchev's SyntaxHighlighter and has a CKEditor instance with SCAYT enabled, a script error is thrown when pasting into the editor.

In Firefox, the error is similar to: "e is undefined", shCore.js line 17.
In IE, the error is similar to "Unable to get value of the property 'valueOf': object is null or undefined",, line 3268.

SyntaxHighlighter uses the XRegExp library, which replaces the native String.prototype.replace(search, replacement) function. SCAYT seems to call the replace function without passing the replacement parameter. The new replace function attempts to call valueOf on the replacement parameter, which throws the error.

This appears to be a bug in SCAYT; however, the native replace function will convert an undefined parameter to the string "undefined", which would mask this problem.

Override the new replace function to cope with an undefined replacement parameter:

        var oldReplace = String.prototype.replace;
        String.prototype.replace = function (search, replacement) {
            if ("undefined" === typeof(replacement)) { replacement = ""; }
            return, search, replacement);

The affected line in the SCAYT code is:


This should be:


Change History (3)

comment:1 Changed 12 years ago by team confirms the problem and offered resolution. The fix will be released during the next release of SCAYT core which will be scheduled during next few weeks.

comment:2 Changed 12 years ago by Jakub Ś

Status: newconfirmed

comment:3 Changed 10 years ago by Piotrek Koszuliński

Resolution: fixed
Status: confirmedclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy