Breelander wrote:Additions are welcome though - the new [align=] for instance. This (and any other BBcode) can be used within each cell of a Table. See...
viewtopic.php?f=28&t=1342#p13142
Hmmmm ... there's an issue here,
[align=(eg)center] generates HTML of the form:
<span style="display: block; text-align:center"> ... </span>.
That's a potentially problematic thing to do as
<span> is an
inline element, and while the css style will make it
display as a block it doesn't change it, semantically, to being a
block-level element.
Now, while that's not a big deal in isolation (although it is "discouraged ", see the HTML standard at
https://www.w3.org/TR/html401/struct/gl ... ml#h-7.5.3) the issue comes about when other BBCodes generating
block-level elements are embedded with it, as
inline elements can only contain
other inline elements.
E.g. A [pre] inside an [align] would generate
<span ...><pre> xxx </pre></span>, which is invalid HTML, 'cos the
<pre> is a block-level element and those can't be contained within an inline element, and as that's invalid HTML it's pot luck as to how browsers may choose to display it (that particular combo seems to work as you might expect in the latest Firefox on W10, but that's no guarantee either for other browsers or, indeed, for future versions of Firefox).
Now, for [align=], as (AFAICS) there's no reason or advantage to it as is, it should simply be changed to use
<div> (which is a block-level element) instead, so generating, e.g.
<div style="text-align:center"> ... </div>On a more general point, AFAICS there doesn't seem to be anything in phpBB to prevent/filter out/correct invalid HTML being generated by combinations of BBCodes, and maybe that's not possible. However, I would recommend looking through the existing BBCodes to see if any of them could, in combination with others, potentially violate the HTML standard in this respect. See link above.
It's also worth testing against the W3C validitor. I.e. create a post with the BBCode combinations you want to check in the Testing 123 forum and then run the page through
https://validator.w3.org/