Closed Bug 78703 Opened 23 years ago Closed 23 years ago

Alignment in composer should not rely only on DIVs

Categories

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

defect

Tracking

()

VERIFIED DUPLICATE of bug 102135
mozilla1.0

People

(Reporter: glazou, Assigned: glazou)

Details

I find very strange that Composer always inserts a DIV if you change the
alignment of a given element.

Test case :

  1) launch composer
  2) enter some text
  3) turn this text into a H1 using the pulldown in Format toolbar
  4) click on the "Center alignment" button

The resulting markup is the following one :

  <div align="Center">
    <h1>a title</h1>
  </div>

It is, IMHO, far too verbose. <h1 align="center">a title</h1> is enough, valid
and very common on the web.

Furthermore : in nsHTMLEditRules::GetAlignment(), the ALIGN attribute
is only checked when carried by a DIV...

Test case :

   1) launch composer
   2) switch to HTML mode
   3) enter the following markup :

       <p align="center">centered text</p>

   4) switch back to normal mode and place the caret in the text
 
The "center alignment" button is *not* selected but should be selected. The
markup entered is perfectly valid, the paragraph *is* centered.

Some existing and archived bugs (bug 76752 for instance) related to element
alignment are directly connected to this one. Solving this one would solve the
others.
actually the align attribute is deprecated for all elements except COL, 
COLGROUP, TBODY, TD, TFOOT, TH, THEAD, and TR. Setting the align attribute on 
the specified element is no more incorrect than adding the DIV element, which 
could have the possibility of interfering with any existing CSS within the file. 
So, dropping the DIV inclusion makes sense, assigning to jfrancis and setting to 
 1.0 for now
Assignee: beppe → jfrancis
Priority: -- → P3
Target Milestone: --- → mozilla1.0
there is not neccessarily any element to set the align on.  consider selecting 
some, but not all, of the textlines present in a body.
Joe : yes, and that why I titled this bug "should not rely only on DIVs". In some
cases, you need a DIV. But in most cases, you don't.
daniel gets the glory for fixing this!
Assignee: jfrancis → glazman

*** This bug has been marked as a duplicate of 102135 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.