Opened 11 years ago

Closed 7 years ago

#9780 closed Bug (fixed)

Calling setReadOnly(true) in IE 8 and 9 then clicking in the entry area causes Javascript Error

Reported by: Alex Florin Owned by: Mateusz Samsel
Priority: Nice to have (we want to work on it) Milestone:
Component: Core : Read-only Version: 4.0
Keywords: Cc:

Description (last modified by Jakub Ś)

Calling setReadOnly(true) in IE 8 and 9 then clicking in the entry area of the editor causes the Javascript Error listed below.

I have tried it on the latest version of Chrome, Firefox and Safari and none exhibit the problem. I have NOT tried it in other versions of IE.

Message: Unable to get value of the property 'ownerDocument': object is null or undefined Line: 303 Char: 472 Code: 0 URI: http://wolf/Pathway/ckeditor/ckeditor.js?0111891205

Message: Unable to get value of the property 'ownerDocument': object is null or undefined Line: 303 Char: 472 Code: 0 URI: http://wolf/Pathway/ckeditor/ckeditor.js?0111891205


Simplified TC:

  1. Set editor to readOnly:true
  2. Load editor with empty content area
  3. Click inside editor

JS error:
Message: SCRIPT5007: Unable to get value of the property 'ownerDocument': object is null or undefined.
Line: 370
URI: /ckeditor/core/selection.js

Problem can be reproduced from CKEditor 3.6.3 rev. [7374] in IE8-10.

Attachments (1)

Desktop.zip (704 bytes) - added by Jakub Ś 11 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 11 years ago by Alex Florin

Oops. Sorry about including the link to my local ckeditor.js.

comment:2 Changed 11 years ago by Jakub Ś

Status: newpending

I was not able to reproduce this neither in my local build nor in demo page.

  1. Are you able to reproduce this issue only in your app or perhaps on demo page or clean editor without any customizations?
  2. Another option is that you IE settings are causing this thus it would be nice if you could provide exact steps to reproduce this.

comment:3 Changed 11 years ago by Alex Florin

Hey,

I forgot to mention its running under asp.net. However I took that out of the equation and I'm still seeing it. Right in the ckeditor folder, I created HTMLPage1.htm and HTMLPage1.js.

Heres the HTMLPage1.htm:

<!DOCTYPE html PUBLIC "-W3CDTD HTML 4.01EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>

<title></title> <script language="JavaScript" src="ckeditor.js" type="text/javascript"></script> <script language="JavaScript" src="HTMLPage1.js" type="text/javascript"></script>

</head>

<body onload="handleOnLoad();">

<textarea id="TextBox1" cols="20" rows="2"></textarea>

</body>

</html>

Here is HTMLPage1.js:

function handleOnLoad() {

CKEDITOR.replace('TextBox1', {

on: {

'instanceReady': function (ev) {

ev.editor.setReadOnly(true);

}

}

});

}

When I click on the htm page, the page loads in IE with ckeditor disabled. If I click in the entry area, I get the error in line c.parentElement().ownerDocument of the following code:

CKEDITOR.on("instanceCreated", function (a) {

... ... ...

if (CKEDITOR.env.version > 7) {

n.on("mousedown", function (a) {

if (a.data.getTarget().is("html")) {

e.on("mouseup", r); n.on("mouseup", r)

}

});

var r = function () {

e.removeListener("mouseup", r); n.removeListener("mouseup", r); var b = CKEDITOR.document.$.selection,

c = b.createRange();

b.type != "None" && c.parentElement().ownerDocument == a.$ && c.select()

}

}

It's possible its some IE setting in my box. I'll try it on another developer's machine when I get into work on monday.

comment:4 Changed 11 years ago by Alex Florin

I just noticed that if I set readOnly:true in the replace call, there is no error. So it only occurs when calling the setReadOnly(true) function AFTER the ckeditor is loaded.

comment:5 Changed 11 years ago by Alex Florin

I have tried it on another developer's machine running IE 10 (beta) on windows 7 and it has the same issue. My PC is running windows 7 IE 9.0.8112.164421 with update version 9.0.11

comment:6 Changed 11 years ago by Jakub Ś

@aflorin, thank you for the information and don't worry I will check this once more. I Just need some time.

Changed 11 years ago by Jakub Ś

Attachment: Desktop.zip added

comment:7 Changed 11 years ago by Jakub Ś

Problem can be reproduced from CKEditor 3.6.3 rev. [7374] in IE8-10.

To reproduce just copy attached files into editor samples folder, load page in browser and click in content area.

Other tickets caused by this revision are #8919 and #9329.

comment:8 Changed 11 years ago by Jakub Ś

Description: modified (diff)
Status: pendingconfirmed

#10309 was marked as duplicate

comment:9 Changed 11 years ago by Joel

Reproducible in IE10. This is closely linked to selections, you can reproduce the error in JS console with

CKEDITOR.document.$.selection.parentElement().ownerDocument
// CKEDITOR.document.$.selection is [object MSSelection]

You can do this at any point to get the same error, not only when the editor is disabled. It seems that this code is just only called when the editor is disabled and a user clicks on the area, so that's why the bug appears in that situation.

Also for further information; this seems to happen in the mouseup event.

comment:10 Changed 11 years ago by Mauricio Farinelli

Do you guys have some fix for this? I get the same problem.

I load a page with some CKEDITOR's instances, but sometimes I need to set readOnly in one of the instances. Then, I get:

SCRIPT5007: Impossible d’obtenir la propriété  « innerHTML » d’une référence null ou non définie 
ckeditor.js, Ligne 17 Caractère 45

and If I click on it, I get:

SCRIPT5007: Impossible d’obtenir la propriété  « ownerDocument » d’une référence null ou non définie 
ckeditor.js, Ligne 131 Caractère 1519

comment:11 Changed 9 years ago by Juan Carreño

I've made a workaround for this issue. I post it here, should it help you:

At core/selection.js, line 756

Instead of:

if ( sel.type != 'None' && range.parentElement().ownerDocument == doc.$ )

Use this:

if ( sel.type != 'None' && (range.parentElement() || {}).ownerDocument == doc.$ )

comment:12 Changed 7 years ago by Paul Vrugt

Any news on this? This bug is now FOUR year old, and the last activity is 20 months ago. The fix seems fairly easy so is it possible to include this fix in a release?

comment:13 Changed 7 years ago by Marek Lewandowski

Priority: NormalNice to have (we want to work on it)

Let's check this one, as it's easy to reproduce.

comment:14 Changed 7 years ago by Jakub Ś

It is possible #16820 is related and perhaps both could be solved with the same fix.

comment:15 Changed 7 years ago by Mateusz Samsel

Owner: set to Mateusz Samsel
Status: confirmedassigned

comment:17 Changed 7 years ago by Mateusz Samsel

Status: assignedreview

comment:18 Changed 7 years ago by kkrzton

Resolution: fixed
Status: reviewclosed

Fixed with 84f72ad.

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