#13064 closed Bug (invalid)
getById() dont work wint anchors
Reported by: | Denis | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
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 http://ckeditor.com/demo[[BR]]
2) In browser console run:
console.log(CKEDITOR.instances['editor1'].document.getById('quotes'))
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 10 years ago by
Keywords: | getById anchors null fake removed |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Version: | 4.4.7 |
comment:2 Changed 10 years ago by
If you (developers) set id and name to fake img from anchor all be fine and don't need to reinvent the wheel.
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 http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.link-method-tryRestoreFakeAnchor to get the anchors.
But it's not a bug - it's simply how it works.