I'm working on the following selector in jQuery:
$("div[id^=WebPartWPQ]:has(table.ms-sitedirresultssort) td:contains(' : ')").closest('div')
In other words: select the div with ID starting with WebPartWPQ
that has a table with class ms-sitedirresultssort
that has a td containing the text :
. At the end of this question is the HTML rendered by SharePoint.
The selector works perfectly under Firefox 3.5, however not under Internet Explorer 8. I'm testing by using the hide()
function.
I've narrowed it down to the td:contains(' : ')
part of the selector. Running $("td:contains(' : ')")
in Firebug Lite dumps out a whole list of functions like something isn't valid. All the other selectors work fine in FB Lite.
I've tried using jQuery 1.3.2 and jQuery 1.4rc1 without success. Is this a bug in jQuery and if so is there a ticket for it (I can't find one)? Any ideas on how to best get around this?
HTML:
<div style="" helpmode="1" helplink="/_layouts/help.aspx" allowdelete="false" class="ms-WPBody"
width="100%" id="WebPartWPQ4" haspers="false" webpartid="2ae67b12-82db-4238-8be9-cd4b39cbd15a">
<table cellspacing="0" cellpadding="0" border="0" width="100%" xmlns:crwp="urn:schemas-microsoft-com:CategoryResultsWebPart"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema"
class="ms-sitedirresultssort">
<tbody>
<tr>
<td width="100%" />
<td nowrap="">
<a href="#title">Sort by Title </a><span>| </span><a href="#url">Sort by Url </a>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%" xmlns:crwp="urn:schemas-microsoft-com:CategoryResultsWebPart"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema"
class="ms-sitedirresultspaging">
<tbody>
<tr>
<td> : </td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%" xmlns:crwp="urn:schemas-microsoft-com:CategoryResultsWebPart"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema"
class="ms-sitedirresultsbody" id="table2">
<tbody>
<tr>
<td valign="top">
<img alt="" src="/_layouts/images/lstbulet.gif" />
</td>
<td width="100%" class="ms-sitedirresultstitle">
<a href="http://site/cd10/_layouts/mysite.aspx?Redirect=1">Setup MySite</a>
</td>
</tr>
<tr>
<td />
<td width="100%" class="ms-sitedirresultsurl">
<a dir="ltr" href="http://site/cd10/_layouts/mysite.aspx?Redirect=1">http://site/cd10/_layouts/mysite.aspx?Redirect=1</a>
</td>
</tr>
</tbody>
</table>
</div>