[wp-trac] [WordPress Trac] #4723: kses removes last attribute in empty xhtml elements

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 10 08:07:37 GMT 2007


#4723: kses removes last attribute in empty xhtml elements
-----------------------+----------------------------------------------------
 Reporter:  whoismanu  |       Owner:  anonymous                           
     Type:  defect     |      Status:  new                                 
 Priority:  normal     |   Milestone:  2.4 (future)                        
Component:  General    |     Version:  2.2.1                               
 Severity:  normal     |    Keywords:  kses posting verification formatting
-----------------------+----------------------------------------------------
 `wp_filter_post_kses` removes the last attribute from an empty xhtml tag
 (even if it is an allowed one) if there is no whitespace between the last
 attribute and the closing `/>`. Now, according to my understanding of the
 xhtml specification there
 [http://www.w3.org/TR/xhtml1/#h-4.6 doesn't have to be a whitespace].

 Here's an example with an img tag (especially annoying because it kills
 the src attribute and you are left with no clue as to why your image
 doesn't show up):

 {{{
 $texttest = '<img width="700" height="525" alt="Wrecked I"
 src="http://www.whoismanu.com/wp-content/2007_08/img_2659_web.jpg"/>';
 wp_filter_post_kses($texttest);
 }}}

 And here's what goes into kses and what comes out:

 {{{
 data in: <img width="700" height="525" alt="Wrecked I"
 src="http://www.whoismanu.com/wp-content/2007_08/img_2659_web.jpg"/>

 data out: <img width="700" height="525" alt="Wrecked I">
 }}}

 Here's an example where there is whitespace, kses handles it correctly:

 {{{
 $texttest = '<img width="700" height="525" alt="Wrecked I"
 src="http://www.whoismanu.com/wp-content/2007_08/img_2659_web.jpg" />';
 wp_filter_post_kses($texttest);
 }}}

 Here's the result:

 {{{
 data in: <img width="700" height="525" alt="Wrecked I"
 src="http://www.whoismanu.com/wp-content/2007_08/img_2659_web.jpg" />

 data out: <img width="700" height="525" alt="Wrecked I"
 src="http://www.whoismanu.com/wp-content/2007_08/img_2659_web.jpg" />
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4723>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list