Last modified: 2008-08-25 10:14:48 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 T17246, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15246 - divs with display: inline still have paragraphs added around them (are treated as block-level by the parser)
divs with display: inline still have paragraphs added around them (are treate...
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
PC Windows XP
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://en.wikipedia.org/wiki/User:Dan...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-20 01:17 UTC by Dan_Pelleg
Modified: 2008-08-25 10:14 UTC (History)
1 user (show)

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


Attachments

Description Dan_Pelleg 2008-08-20 01:17:55 UTC
1. css "display: inline" works only in blockquotes created using : or * or #. In plain paragraphs, line breaks are inserted before and after the inline element. In blockquotes created by the html blockquote tag, a line break is entered only before the inline element.

2. Negative top and bottom margin values work for table cells but not for DIVs in Internet Explorer, and they for DIVs but not for table cells in Mozilla.

Both bugs are demonstrated at:

http://en.wikipedia.org/wiki/User:Dan_Pelleg/Inline_element

(I'm using this platform to report a bug, meaning "a defect in the software". If I'm in the wrong place, place point me to the right one!)

Thanks

Dan
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-08-20 01:21:03 UTC
Please say, for each error, what you input, what the actual result is, and what the expected result is.  I have no idea what you think is happening or should be happening.
Comment 2 Dan_Pelleg 2008-08-20 12:05:01 UTC
I enter:
text before<div style="display: inline;>-inline-text-</div>&nbsp;text after

I expect:
text before-inline-text- text after

I get:
text before
-inline-text-
 text after

However, when I enter:
*text before<div style="display: inline;">-inline-text-</div>&nbsp;text after

It works, i.e. I get:
* text before -inline-text- text after

And it works well also when I replace the "*" with ":" or "#".
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-08-20 14:46:47 UTC
This is probably not avoidable.  The parser has to know whether the element is block-level or inline-level, and if it thinks it's block-level it shouldn't add paragraphs around it.  The parser can't possibly know what CSS style the element will have when viewed.  You need to use <span> in this situation.
Comment 4 Dan_Pelleg 2008-08-23 21:56:37 UTC
Thanks, please forgive my layman-ness; since your phrasing seems to be too technical for me to make sense of it I'll rephrase: how can I put a table into a text without line-breaks happening before and after it? 

- - Just to make sure my preceding query wasn't misunderstood: adding the style attribute "display:inline" to the table's style definition in the text's source thus: <table style="display:inline;"> always works in html-files (i.e., not on Wiki projects) viewed in Internet Explorer, Mozilla and Safari, it also works in Wikipedia, but only when the first character of the paragraph within which the table is placed is : or * or # (without them, line-breaks are added before and after the element, i.e. the attribute "display:inline" is ignored). Unless the "display:inline" attribute is non-standard, it would seem to me that Wiki has a bug here, but if I'm wrong, I would greatly appreciate it if you could explain the matter to me. By the way, exactly the same behaviour happens with <div> and <p>, including the fact that the inline property is always correctly displayed by Internet Explorer, Mozilla and Safari when viewing html-files (i.e., not on Wiki projects).
Comment 5 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-08-24 01:21:48 UTC
(In reply to comment #4)
> Thanks, please forgive my layman-ness; since your phrasing seems to be too
> technical for me to make sense of it I'll rephrase: how can I put a table into
> a text without line-breaks happening before and after it?

This should work:

<div>Text <table style="display: inline-table;"><tr><td>Table cell</td></tr></table> more text</div>

Not all browsers support inline-table.  You could try inline as well, which seems to work, although I don't know why.

> - - Just to make sure my preceding query wasn't misunderstood: adding the style
> attribute "display:inline" to the table's style definition in the text's source
> thus: <table style="display:inline;"> always works in html-files (i.e., not on
> Wiki projects) viewed in Internet Explorer, Mozilla and Safari

The markup that corresponds to the wikitext you want is this:

<p>Text <table style="display: inline;"><tr><td>Table cell</td></tr></table> more text</p>

This markup is invalid.  <table> cannot be contained in <p>: <p> can only contain inline-level elements.  Browsers may accept it, but it's still invalid.  Therefore, the wiki refuses to do that, and generates this instead:

<p>Text</p> <table style="display: inline;"><tr><td>Table cell</td></tr></table> <p>more text</p>

which breaks it onto three lines.  You have to override the automatic addition of <p> to get around this, by wrapping the line in some other tag like <div>, <blockquote>, etc. (which can have <table> inside it).
Comment 6 Dan_Pelleg 2008-08-24 09:15:22 UTC
Thanks! Wrapping the text with <div> made it work, though only with "inline", whereas "inline-table" again causes line-breaks to be inserted before and after the table. So what works is only:

<div>Text <table style="display: inline;"><tr><td>Table
cell</td></tr></table> more text</div>

Thanks again also for explaining the mode of operation. Out of plain curiosity: why this difference between what the <p> and <div> tags enable? By the way, inserting a table (or div) with "display: inline;" into a text wrapped with <blockquote> works only partially, i.e.  it results in no line-breaks added after the element but with a line-break inserted before it.
Comment 7 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-08-24 14:06:48 UTC
The reason for the difference is because the XHTML 1.1 standard specifies that a <p> element must not contain anything but inline-level elements.  Why that is, you'd have to ask the XHTML standards group.  FWIW, I recall reading that later versions of the standard will be more generous with what's permitted in paragraphs.

<blockquote> may work differently at the moment because our support for it is apparently buggy, divs are special-cased where they shouldn't be.  See bug 6200.  inline-table works fine for me in Firefox 3, but it may not work in some browsers.
Comment 8 Dan_Pelleg 2008-08-25 10:14:48 UTC
I see. Thanks very much for your help!

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


Navigation
Links