Last modified: 2012-07-03 06:55:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38495, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36495 - Sanitizer shouldn't convert "align" attribute to text-align for non-table-cells
Sanitizer shouldn't convert "align" attribute to text-align for non-table-cells
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.19.0
All All
: Low minor (vote)
: 1.20.0 release
Assigned To: Max Semenik
: code-update-regression
: 36586 37114 (view as bug list)
Depends on:
Blocks: 27478
  Show dependency treegraph
 
Reported: 2012-05-03 19:36 UTC by genio2003
Modified: 2012-07-03 06:55 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description genio2003 2012-05-03 19:36:18 UTC
When I use in a table align="right" doesn't display on the right side...

{| align="right" border="1"
| Col 1, row 1
| rowspan="2" | Col 2, row 1 (and 2)
| Col 3, row 1
|-
| Col 1, row 2
| Col 3, row 2
|}

with style="float:right;" it works, but before running versions align="right" works, too.

{| style="float:right;" border="1"
| Col 1, row 1
| rowspan="2" | Col 2, row 1 (and 2)
| Col 3, row 1
|-
| Col 1, row 2
| Col 3, row 2
|}
Comment 1 Mark A. Hershberger 2012-05-04 14:52:52 UTC
Which browser?  Tested firefox, chromium and Opera on https://en.wikipedia.org/wiki/User:MarkAHershberger/sandbox3 and all appeared to work.
Comment 2 genio2003 2012-05-04 20:16:26 UTC
Looks like it works on wikipedia.org sites, but mediawiki.org same problem with the systax like my private wiki (based on Mediawiki 1.19.0)...
Comment 3 Erik 2012-05-27 12:36:25 UTC
Yes I can confirm this bug. For me its the Align=center. It used to work OK before and its messed up some formatting. It works on Wikipedia and it doesn't work on a new 1.19. 
{| align="center"
is rendered on a new MW 1.19 and on Mediawiki.org as:
<table style="text-align: center;">

But it renders differently on en.Wikipedia.org:
<table align="center">
Comment 4 Erik 2012-05-27 12:48:25 UTC
There's two additional bugs (duplicate). One of them has a suggested solution for correct CSS (I didn't verify the solution to see if its the best):
https://bugzilla.wikimedia.org/show_bug.cgi?id=36586

The other duplicate is:
https://bugzilla.wikimedia.org/show_bug.cgi?id=37114
Comment 5 Krinkle 2012-05-27 12:51:08 UTC
* align="left" and align="right" have been deprecated for years. All browsers around today map this internally to float:left and float:right respectively.

* float: center; doesn't exist and has never existed. This is a common mistake but not a bug.

* As of MediaWiki 1.19 the Sanitizer class converts these to CSS (but only if the wiki is in HTML5 mode, which it is by default, but Wikipedia has HTML5 mode disabled. MediaWiki.org has it enabled and your own install will have it enabled by default as well)

* Short term solution: Do not use align="", valign="", clear="" etc. Instead use CSS or inline style="" as these attributes have all been deprecated for a long time.

* Long term solution: align="" is converted by Sanitizer to only text-align. For left/right it should also include `float` (depending on the element).
Comment 6 Krinkle 2012-05-27 12:51:48 UTC
*** Bug 37114 has been marked as a duplicate of this bug. ***
Comment 7 Krinkle 2012-05-27 12:52:05 UTC
*** Bug 36586 has been marked as a duplicate of this bug. ***
Comment 8 Krinkle 2012-05-27 12:54:18 UTC
(aggregated from the dupes)

* align="*" on table-cells (left, right, center)
   -> style="text-align: *;"

* align="*" on other elements (left, right)
  -> style="float: *;"

* align="center" on other elements
  -> style="margin-left: auto; margin-right: auto;"
Comment 10 Krinkle 2012-06-28 21:46:47 UTC
(In reply to comment #9)
> Sanitizer::fixDeprecatedAttributes
> 
> https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/Sanitizer.php;hb=bc9d9f1f9c796ee01234f484724cc064b9008eba#l614

Per [1], this link points to the cave where this bug is making out.

-- Krinkle

[1] http://lists.wikimedia.org/pipermail/wikitech-l/2012-June/061496.html
Comment 11 Max Semenik 2012-06-29 16:26:08 UTC
Proposed fix submitted in https://gerrit.wikimedia.org/r/13479
Comment 12 Krinkle 2012-07-03 06:55:18 UTC
I108cbd100cff6bade011b14d74b5bca82f2a1e5f: Merged in master.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links