Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#13064 closed Bug (invalid)

getById() dont work wint anchors

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


I want move cursor to anchors from script. To do this, need select anchor by getById. But getById for anchors always null. Maybe because the anchor fake element?

For reproduce:

1) Go to[[BR]]

2) In browser console run:


3) Got null, but in source we have:

<h2>Broadcasting and <em>quotes</em> <a id="quotes" name="quotes"></a></h2>

How to move cursor an anchor?

Change History (2)

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

Keywords: getById anchors null fake removed
Resolution: invalid
Status: newclosed
Version: 4.4.7

Maybe because the anchor fake element

Yes - empty anchors are converted into "fake elements" (i.e. images with special attributes). You need to find other way to find a proper fake element representing anchor that you look for in the DOM. E.g. document.find( 'img.cke_anchor' ) and then you can either take a shortcut and try to husk an id from data-cke-realelement, or use!/api/ to get the anchors.

But it's not a bug - it's simply how it works.

comment:2 Changed 9 years ago by Denis

If you (developers) set id and name to fake img from anchor all be fine and don't need to reinvent the wheel.

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