Re: attribute or CSS property?

>
> I had an informal conversations with my colleagues, who pointed out
> that making them to attribute will allow browsers to determine
> editability without computing styles, but we'll probably need to take
> display:none into account, so I guess it won't make much differences.


>From an editor perspective attributes seem to be much better. We are often
traversing DOM to check whether some element is inside editable container
or not and we do that also on detached DOM (when processing input/output
data). If we would need to check computed styles I think it would be both -
slower and/or more limited/complicated.

Moreover, the editable and non-editable elements would need to be marked
somehow. These classes (or any other editor related markers) should not
leaking to the database. So the data processing step, which I think all
editors implement, is a must-have. Therefore, there's no problem with using
attributes.


PS.

(...) but we'll probably need to take display:none into account (...)


Visibility does not affect editability -
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25908



-- 
Piotrek Koszuliński
CKEditor JavaScript Lead Developer

Received on Tuesday, 9 December 2014 10:28:36 UTC