Opened 15 years ago
Last modified 15 years ago
#6334 closed Bug
Use data-* attributes for custom attributes — at Version 8
| Reported by: | Sa'ar Zac Elias | Owned by: | Sa'ar Zac Elias |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.5 |
| Component: | General | Version: | |
| Keywords: | Cc: |
Description (last modified by )
As we're walking towards HTML5 support, and because of FF's latest problems with custom attributes (which, as seems, won't be fixed very soon), we should start using the data-* attributes for custom attributes.
Change History (9)
comment:1 Changed 15 years ago by
| Status: | new → assigned |
|---|
Changed 15 years ago by
| Attachment: | 6334.patch added |
|---|
comment:2 Changed 15 years ago by
| Milestone: | → CKEditor 3.5 |
|---|---|
| Status: | assigned → review |
comment:3 Changed 15 years ago by
| Status: | review → review_failed |
|---|
The patch is not good in the sense of mixing the job of 'setCustomData', this FF dedicated problem should be fixed instead silently inside element::set(get)Attribute once a '_cke' prefix is seen, then the change would be also much smaller.
comment:5 Changed 15 years ago by
| Keywords: | Discussion added |
|---|
Me and Fred have talked about it before and decided to change the element::[get/set/remove]CutsomData methods. The point of this "transfer" is not only to resolve the FF bug (starting version 3.6.9, partially fixed for 3.6.11 AFAIK), but also to use the new HTML5 addition, whose definition matches our purpose. Thus the goal is to use these attributes also for browsers which currently do accept our approach. Opinions?
Anyway, let's hold the full review of this ticket to include new incoming additions to the code (e.g. the placeholder plugin) and old incomings (e.g. iframe plugin).
comment:6 Changed 15 years ago by
Just that you know, FF bug: Element Attributes dropped in DesignMode/ContentEditable sections is listed as fixed for FF3.6.11 https://bugzilla.mozilla.org/show_bug.cgi?id=596300
Didn't bother to read through whether it is partial or full fix since I'm fine with data-attributes and I believe that is the way CKEditor should take.
comment:7 Changed 15 years ago by
Although this part of the change seems simple, we must be careful about storing new data using attributes in the DOM nodes instead of the customData object because that means extra work for the browser, it's not just setting the attribute/property on a different element, DOM nodes have different rules, so the browser does a lot of work to access them and it can mean worse performance. I think that the browser that will notice it the most are older Firefoxes.
I would vote for just changing the existing _cke to data-cke and after that, test if the performance is affected or not by extending it to the customData functions.
Side note: to improve a little the code compression it should be possible to define a variable to store the "data-cke-expando" string and use that variable instead of the full string when it's used several times in a function or object.
comment:8 Changed 15 years ago by
| Description: | modified (diff) |
|---|

For FF, it should be tested with the nightly build for now (until the next release), so the data-* attributes would be recognized as "safe".