Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#16351 closed defect (bug) (invalid)

Default Text Widget Creates Invalid HTML

Reported by: clwill Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.4
Component: General Keywords: Text Widget
Focuses: Cc:


The default text widget in default-widgets.php creates HTML that is invalid. Older browsers (specifically IE6) stop rendering when they hit the construct, disabling the entire rest of the sidebar.

The issue is that the widget includes a <div> inside a <li>, which renders fine (is ignored) in later browsers, but a) doesn't validate, and b) causes IE6 to puke, as noted above.

The specific error is line 382:

<div class="textwidget"><?php echo $instancefilter? ? wpautop($text) : $text; ?></div>

Two suggested possibilities: 1) Remove the div entirely or 2) if the class is deemed necessary, replace it with a <span class="textwidget"></span>

Change History (9)

#1 @SergeyBiryukov
10 years ago

Twenty Ten with a <div> inside a <li>:
a) validates,
b) looks fine in IE6.

Not sure what the problem is.

#2 @clwill
10 years ago

Please try adding a text widget with a title and some text inside it.

#3 @SergeyBiryukov
10 years ago

Done: http://ruproject.wordpress.com/

Still validates and looks OK in IE6.

#4 follow-up: @clwill
10 years ago

After further testing, I apologize.

The following text in the widget doesn't render in IE6. It does seem to validate:

<a href="#"><img src=" http://auto-aero.com/wp-content/uploads/2011/01/Got.jpg" alt="" /></a>This is a test

I'm not sure what the combination that causes the problem is. Is it the Image? Is it the link? I don't know but check out http://auto-aero.com. It doesn't render properly in IE6.


#5 @clwill
10 years ago

I have two complex sites (don't lend themselves to small examples) that fail to render properly in IE6. One does not validate when the <div> is in the default text widget. If I edit default-widgets.php and remove the <div> it does validate. I apparently need to work on the specific test case.

#6 in reply to: ↑ 4 @SergeyBiryukov
10 years ago

Replying to clwill:

I'm not sure what the combination that causes the problem is.

I saved that page, added a space after the link and it seems to fix the problem.
Anyway, it's a specific theme/markup issue rather than WordPress core, so support forums would be more appropriate place.

#7 @clwill
10 years ago

There are others on the support forum with this issue. They have fixed it by removing the <div>. I will come up with a specific case, that demonstrates in twentyten. Bear with me.

#8 @clwill
10 years ago

And right you are. It was an error in the theme code.

Sorry for the noise.

#9 @dd32
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.