Opened 10 years ago

Closed 9 years ago

#5324 closed Bug (duplicate)

Dialogs contain invalid html id's

Reported by: Tim Fluehr Owned by:
Priority: Normal Milestone:
Component: UI : Dialogs Version: 3.2
Keywords: Cc:

Description

According to the spec dialogs in CKEditor contain some invalid id's. Some of the id's start with numbers which are not valid and break firefox (throw a javascript error) when you try to use querySelectorAll which was introduced in version 3.5.

to reproduce the error open the Image dialog and execute "document.querySelectorAll('#133_uiElement')" in FireBug.

Change History (5)

comment:1 Changed 10 years ago by Alfonso Martínez de Lizarrondo

Milestone: CKEditor 3.3

You aren't supposed to directly access those elements that way. Instead you should use the API to get the dialog elements that you want to modify because those numbers won't be the same according to the version of CKEditor, the browser used and the order in which dialogs are launched.

comment:2 Changed 10 years ago by Tim Fluehr

just to clarify, I wasn't using that specific code. That was just a simple example to reproduce the issue.

I ran into a problem because I was using prototype.js css selectors to find/change items that I had added to a dialog manually. No where in my code did I specifically reference an id. But because the id was there it was used at one point and broke my code.

Regardless of whether someone is trying to manually use the id's or not I think that the id's used should still be valid.

comment:3 Changed 10 years ago by Alfonso Martínez de Lizarrondo

Yes, I didn't said that this isn't a problem that shouldn't be fixed. Just that it isn't high priority because in normal use it won't cause any problem and there are other ways to handle the data in the dialogs.

You could also file a bug with prototype.js because if you aren't trying to get elements that way it shouldn't be doing such calls.

comment:4 Changed 10 years ago by Tim Fluehr

I can understand it not being a high priority, I just wanted to make sure it would be fixed at some point. I have already found a workaround for my code, but I wanted to post the bug (plus have it logged in case someone else ran into it)

It's not really a prototype bug though. It comes about because document.querySelectorAll will only search the entire document and sometimes you just want to search a portion of the document so in those cases prototype allows you to do element.select(cssSelector). It then modifies that behind the scenes to add in an element id to cssSelector to be passed to document.querySelectorAll so that it can still use the native functionality which is much faster then parsing the dom manually.

I found the issue by doing an element.select from the dialog dom element to a className and then doing additional selects off of that found element. The issue poped up when the element with the className wound up having the invalid id.

comment:5 Changed 9 years ago by Alfonso Martínez de Lizarrondo

Resolution: duplicate
Status: newclosed

dup of #5531

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