我正在下面選擇在jQuery選擇:有問題:包含IE8
$("div[id^=WebPartWPQ]:has(table.ms-sitedirresultssort) td:contains(' : ')").closest('div')
換句話說:選擇帶有ID的DIV開始WebPartWPQ
具有與ms-sitedirresultssort
類表中,有一個td包含文字:
。在這個問題的最後是由SharePoint呈現的HTML。
該選擇器在Firefox 3.5下完美工作,但不在Internet Explorer 8下。我正在使用hide()
函數進行測試。
我已經縮小到選擇器的td:contains(' : ')
部分。在Firebug Lite中運行$("td:contains(' : ')")
會拋出一些功能列表,例如某些內容無效。所有其他選擇器在FB Lite中都可以正常工作。
我試過使用jQuery 1.3.2和jQuery 1.4rc1沒有成功。這是jQuery中的一個bug,如果有的話,是否有票(我找不到)?任何想法如何最好地解決這個問題?
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>
我對這裏發佈的HTML進行了修改,修改了''周圍的空格。哎呦!無論如何,謝謝你回答我的錯誤。 – 2010-01-14 00:46:39