Opened 10 years ago
Closed 10 years ago
#13092 closed Bug (invalid)
getAttribute() inside an attachedListener function() returns 'null'
Reported by: | Heinz | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
var buttonElement = '<input type="button" value="click me" data-test="test attribute"></input>'; var linkElement = CKEDITOR.dom.element.createFromHtml(buttonElement, editor.document); editor.insertElement(linkElement); // attach listener to capture clicks editor.editable().attachListener( linkElement, 'click', function() { var attribute = linkElement.getAttribute('data-test'); ... console.log('attribute = ',attribute); }
In the plugin code sample above a listener is attached (as recommended by Reinmar) to an 'input' element to capture mouseclicks. To transport data a customer attribute is implemented. While the anonymos function is called perfectly, the 'attribute = linkElement.getAttribute('data-test');' returns 'null'.
Change History (3)
comment:1 Changed 10 years ago by
Status: | new → pending |
---|---|
Version: | 4.4.8 (GitHub - master) |
comment:2 Changed 10 years ago by
For any reason it works for me now too. Something in my scripts must have been changed and removes this 'bug'. Days ago it wasn'nt working. The click handler was called but the returned attributes where empty, weird. I test with Safari, FireFox and Chrome, all latest versions. Ok, so this ticket can be closed. Thanks a lot …
comment:3 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
Cool :) Closing tickets is always pleasure.
For me it logs:
So everything works perfectly fine.
I tested on Chrome using the replacebycode.html sample.
Could you provide more details on how to reproduce this issue? Perhaps a working sample.