Support » Fixing WordPress » wpautop breaks block-level ins

  • spinnerofcontradictions


    According to the W3C recommendations, <ins> and <del> can be either block-level or inline elements. When they are block-level elements, they can include other block-level elements, such as <p> blocks. Unfortunately, if you enter the following code in a WordPress post (version 1.5.2):

    <p>Main post text.</p><ins datetime=”2005-09-23T08:46:48+00:00″><p>Oh, I forgot: additional paragraph one.</p></ins><ins datetime=”2005-09-23T08:47:44+00:00″><p>Also: additional paragraph two.</p></ins>

    WordPress adds an extra </p> at the end, which of course stops the blog validating as correct XHTML. If you try putting each <ins> element on a new line, then WordPress still adds a superfluous </p>, but now also sticks a <br /> between the two <ins> elements, creating unwanted white space in the layout.

    This bug(?) is breaking validation on my blog with this post.

    (Sorry for not formatting the code in this query as code, but it kept erasing elements, so I gave up.)

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve been doing block-level <ins> and <del> with 1.5.x and it’s always worked, but since upgrading to 2.0 this morning it’s broken. I have XHTML auto-correction turned off, but it doesn’t seem to make a difference if it’s turned on. The behaviour happens with a “virgin” installation and with all content-editing plugins disabled too.

    I’m not sure if this is a complete fix, but it fixes the occurrence I was seeing: in function wpautop, add ins and del to the last two regexes that start with table|thead|. In 2.0 they’re on lines 72 and 74, on opposite sides of the single if ($br) condition.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wpautop breaks block-level ins’ is closed to new replies.