SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm setting up an SP2010 VM for dev testing purposes. Our vanilla install has no other components present and is throwing JS errors in Chrome and Firefox. In Firefox (v13):

a is null
Line 2

In Chrome (current):

Uncaught TypeError: Cannot call method 'parentElement' of null /_layouts/sp.ui.rte.js?rev=aTi1rujCmyK4y06NVUncdQ%3D%3D:2

This is a major blocker for me to test some JS I'm working on and my searches for the error isn't turning anything up. I don't know if it's related, but IE has an HTML warning:

HTML1114: Codepage unicode from (UNICODE byte order mark) overrides conflicting codepage windows-1252 from (11)

Opera 11 doesn't seem to throw the error either.

share|improve this question
What is the patch level of the 2010 vanilla farm? – Eric Alexander Jun 12 '12 at 14:56
I just checked this. It's at 14.0.6114.5001 – patrickgamer Jun 12 '12 at 16:05
Welcome to Microsoft Sharepoint quality coding... – George Katsanos Feb 20 '13 at 15:55
up vote 1 down vote accepted

You can also fix in this way.

SP.SOD.executeFunc('sp.ui.rte.js', null, function () {
    if (/var \$v_0 = RTE\.Selection\.getSelectionRange\(\);[\r\n\t ]*var \$v_1 = \$v_0\.parentElement\(\);/.test(RTE.Canvas.checkCurrentFocus.toString())) {
        var _oldCheckCurrentFocus = RTE.Canvas.checkCurrentFocus;
        RTE.Canvas.checkCurrentFocus = function () {   
                return _oldCheckCurrentFocus();

Use SP.SOD.executeFunc to wait until RTE library is loaded, once it's loaded you first save the original implementation then test if it still has the bug using a Regular Expression, if the bug is there you override the original funcion with a version which will not cause the error.

But note that I did not override it completely, the new function check if RTE.Selection.getSelectionRange() returns a valid object, if it does the old implementation is executed, otherwise the function ends.

This way we do not mess so much with native code, and if Microsoft fix it your code will not override their funciton anymore automatically. And if Microsoft changes the function but keep the bug we guarantee that when the selection exists we will continue executing the newest implementation.

share|improve this answer

I have seen a bug in the SP.UI.RTE.js file that Microsoft has still not resolved. To fix it on environment where I have seen behavior like this, I add the following JavaScript to the master page:

    function fixRTEBug() {
    if (typeof RTE.Canvas.checkCurrentFocus !== 'undefined') {
        RTE.Canvas.checkCurrentFocus = function() {ULSkay:;
            var $v_0 = RTE.Selection.getSelectionRange();
            if ($v_0) { //this is different from SP to avoid error in console
                var $v_1 = $v_0.parentElement();
                if (RTE.Canvas.isInEditable($v_1) && !RTE.Cursor.get_range().isValid()) {

    // This Fix for parentElement bug in RTE should survive Service Packs and CU's
    function SubstituteRTERangeParentElement() {
        var originalRTERangeParentElement = RTE.Range.prototype.parentElement;
        RTE.Range.prototype.parentElement = function () {
            try {
            } catch (e) { }

ExecuteOrDelayUntilScriptLoaded(fixRTEBug, "sp.ui.rte.js");
share|improve this answer

Only after SharePoint SP1 with Cumulative Update from April 2012 is Chrome almost "fully" supported as it has been announced in May 2012 on the Support site

I would go for installing at least Service Pack 1, June Update and Refresh, and try again!

share|improve this answer
and this would be related to Firefox as well? Just checked, and we're already at 14.0.6114.5001 - latest version afaik – patrickgamer Jun 12 '12 at 16:00
Are you using any DOCTYPE on your page? Did you closed all <script> tags with <script></script> when referring external scripts and not simple <script /> – Marius Constantinescu - MVP Jun 12 '12 at 16:13
Nope. this is a strictly vanilla install - we literally installed it, took a snapshot, and started browsing the default pages (et. all) to check this thing out. Note that we originally thought we goofed on the install, so we created a fresh VM - same result. – patrickgamer Jun 12 '12 at 17:35
As C. Marius mentioned, it is almost supported, even to this day, SP2010 is not fully supported (still has scrolling issues). – Russell Jan 9 '14 at 6:53
However SP2013 works as well in Chrome/firefox/safari (FWIHT) as IE. – Russell Jan 9 '14 at 6:54

You can actually load debug versions for js files and see exactly where it crashes. To do this, got to app pool web config, typically to C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config and set

compilation : debug=true

<compilation batch="false" debug="true">

I had a similar issue and it was fixed after a windows update.

share|improve this answer

Adding this to my master page fixed just about all of my Chrome issues


        $ = (typeof === "object");

    function Reinit()
        if(typeof(_spBodyOnLoadWrapper) != "undefined")
            if(_spBodyOnLoadCalled == false)
            setTimeout(Reinit, 10);
share|improve this answer

Just disable WIKI page home page feature from site

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Please add detailed information or provide links to support your answer. A one liner is not treated as a good answer. – Amal Hashim Nov 14 '14 at 18:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.