Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#11925 closed Bug (wontfix)

Calling getUniqueId on a container fails in IE8

Reported by: Chema Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

Calling getUniqueId method on elements seems to be failing in IE8

Steps to reproduce:

  1. Navigate to http://www.ckeditor.com/demo in IE8
  2. Open dev tools
  3. Type the following sequence:
    editor = CKEDITOR.instances.editor1
    container = editor.getSelection().getRanges()[0].startContainer
    container.getUniqueId()
    

Result: An Object doesn't support this property or method error is thrown.

Expected: No error to be thrown and the element unique id to be returned

Change History (6)

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

Status: newconfirmed

Wow... This is very, very odd:

> typeof container.getUniqueId
"function"

> container.getUniqueId.toString()
"function(){return this.$["data-cke-expando"]||(this.$["data-cke-expando"]=CKEDITOR.tools.getNextNumber())}"

> CKEDITOR.tools.getNextNumber()
65

> container.getUniqueId()
"Object doesn't support this property or method"

Looks like an ugly IE8 bug. That will be an awesome fun debugging this :D.

comment:2 Changed 3 years ago by Chema

Glad you like it! :D

Additionally:

> container.getUniqueId.apply(container)
"Object doesn't support this property or method"

> container.getUniqueId.apply(window)
65
Last edited 3 years ago by Chema (previous) (diff)

comment:3 Changed 3 years ago by Marek Lewandowski

most likely it's due to calling text node, it works with elements, see:

var p = CKEDITOR.instances.editor1.editable().getFirst();

// works
p.getUniqueId(); 

var txt = p.getFirst().getNext();

// Does not work
// throws: "Object doesn't support this property or method"
txt.getUniqueId();

// note:
// throws exception: "'this.$.data-cke-expando' is null or not an object"
txt.getUniqueId.call()

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

This method is defined in CKEDITOR.dom.domObject, so it should work on all elements. Although, I remember that on some older IEs the expando didn't work, because it couldn't be set on text nodes. Maybe we were confused by the error message which looks like a method does not exist. Maybe IE throws this when setting textNode.data-cke-expando as Marek said. We'll check this, but if it's right, then it's a "won't fix" of course.

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

Resolution: wontfix
Status: confirmedclosed
>>document.createTextNode('foo')['data-cke-expando'] = 1';
  "Object doesn't support this property or method"

Yup. So getUniqueId can't work on text nodes in IE8. Added note about this in docs: git:81dc62302.

comment:6 Changed 3 years ago by Chema

Thanks for looking into it...

Sad we can't fix this somehow, since it renders that API basically unusable if you need to support IE8 :(

Glad at least we've got it documented now.

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy