Closed Bug 239927 Opened 16 years ago Closed 12 years ago

behavior of useCSS command is backwards

Categories

(Core :: DOM: Editor, defect, minor)

PowerPC
macOS
defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kaldari, Unassigned)

Details

(Whiteboard: midas)

To turn CSS formating off in midas you set useCSS to true:
execCommand("useCSS", false, true);
To turn CSS formating on in midas you set useCSS to false:
execCommand("useCSS", false, false);

Isn't this backwards? It's certainly confusing.
I noticed that the midas editor demo, for example, has to flip the checkbox
value to get it to work right:
function usecss(source)
{
  document.getElementById('edit').contentWindow.document.execCommand("useCSS",
false, !(source));
}

It would make more sense if you could use this instead:
function usecss(source)
{
  document.getElementById('edit').contentWindow.document.execCommand("useCSS",
false, source);  
}

This is also mentioned in <a
href="http://bugzilla.mozilla.org/show_bug.cgi?id=216317#c4">a comment</a> in
bug 216317

Also, does anybody know if there is more comprehensive or up to date
documentation on midas than <a
href="http://www.mozilla.org/editor/midas-spec.html">http://www.mozilla.org/editor/midas-spec.html</a>
Whiteboard: midas
I agree that it is a bug and should be fixed.  However:

If this bug were to be fixed by modifying the behaviour of useCSS to work as it
should, it would actually break compatibility with a large number of online
applications.  The behaviour has been this way since it was introduced in
Mozilla 1.3 and applications (such as HTMLarea and variants, etc) rely on the
incorrect behaviour.

Perhaps an alternative way of "fixing" this would be to modify the documentation
to explicitly state that calling useCSS with 'false' will turn CSS on, and
calling useCSS with 'true' will turn CSS off.

BTW this bug is NOT limited to Macintosh platform or Mac OS X operating system
(please change to "All").  I can confirm on x86/Windows.
Somehow I think a brief period of people fixing their web apps would be less painful in the long run 
than people being confused about how useCSS works for the rest of the life of Mozilla. I'm ready to fix 
the Midas implementation in SiteMason as soon as this is changed. The longer we wait the more painful 
it will be to fix.
(In reply to comment #2)
> Somehow I think a brief period of people fixing their web apps would be less
painful in the long run 

It will be painful, however, as some people will be using Mozilla 0.9 through
1.7 for a long time to come.  If the behaviour is changed there will need to be
some way for applications to be compatible with both the current implementation
and the corrected one.  This means that applications will need to be able to
detect whether CSS mode is on or not, and act accordingly.

Another thing to note is that if the implementation is changed, then the
documentation would have to note both implementations.  It will have to contain
something like:

"In Mozilla versions x.x to x.x, setting useCSS to true turns CSS mode off and
false turns it on.  In Mozilla versions after x.x, setting useCSS true turns CSS
mode on and false turns it off.  Applications should detect which version of
Mozilla is being used and alter their behaviour accordingly."

I believe that this situation will lead to long term confusion.  Also, the
browser sniffing that must occur in order to achieve consistency would be an
irritating burden for developers.
Did someone change the behavior of useCSS? I am using Deer Park Alpha 2 and
useCSS seems to work the 'right' way now, breaking every rich text editor
including the Midas demo with respect to css formatting.
Flags: blocking1.8b4?
Flags: blocking1.8b4? → blocking1.8b4-
(In reply to comment #4)
> Did someone change the behavior of useCSS? I am using Deer Park Alpha 2 and
> useCSS seems to work the 'right' way now, breaking every rich text editor
> including the Midas demo with respect to css formatting.
Yeah, it was "right" and I changed my app, but it changed back to "wrong" within
a week ago. I say change it back to being "right". People can test browser versions.
According to http://www.mozilla.org/editor/midas-spec.html you can use "styleWithCSS" to make it work in a logical way.

Given the availability of styleWithCSS, shouldn't this bug be closed now?
QA Contact: bugzilla → editor
Assignee: mozeditor → nobody
Yeah, probably best to close this as WONTFIX.
Per reporter's suggestion, closing WONTFIX.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.