Switching to jQuery 1.5 breaks a selector
just upgraded to jQuery 1.5 and now it seems the find() has problems with several selctores:
var $AlertColumn = $('[name=TABLE_1] tr').find('.SAPBEXstdData:eq(9), .SAPBEXstdDataOdd:eq(9), td.SAPBEXaggData:eq(9)');
as of 1.5 (and IE7), the thing hangs in IE7 with an error popup after a while that there's a script running forever.
It works perfect in 1.4.2.
ok here comes the code (to the first data row), I have to work on the Alert-Row which is the 9th having those classes used in find():
<TABLE class=SAPBEXCellspacing cellSpacing=1开发者_JS百科 cellPadding=0 width=1250 border=0 name="TABLE_1" sizcache="5" sizset="20"><TBODY sizcache="5" sizset="20">
<TR sizcache="5" sizset="21">
<TD noWrap colSpan=19 sizcache="5" sizset="21">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 sizcache="5" sizset="21">
<FORM name=SAPBWUForm5 action=/sap/bw/BEx?SAP-LANGUAGE=DE&ITEM=TABLE_1&STATE_ID=4KXJZOX5URFHG6BQFFTKAJ0OH&STATELESS=X&LAST_MESSAGE_ID=0 method=post sizcache="5" sizset="21">
<TBODY sizcache="5" sizset="21">
<TR sizcache="5" sizset="22">
<TD class=SAPBEXScrollVert noWrap sizcache="5" sizset="22">
<TABLE cellSpacing=0 cellPadding=1 border=0 sizcache="5" sizset="22">
<TBODY sizcache="5" sizset="22">
<TR>
<TD class=SAPBEXTxtStd noWrap><IMG title="Erste Zeile" alt="Erste Zeile" src="/sap/bw/Mime/BEx/Icons/page_first_row_inact.gif" border=0></TD>
<TD class=SAPBEXTxtStd noWrap><IMG title="Vorherige Zeilen" alt="Vorherige Zeilen" src="/sap/bw/Mime/BEx/Icons/page_up_inact.gif" border=0></TD>
<TD class=SAPBEXTxtStd noWrap> <LABEL>Zeile</LABEL></TD>
<TD noWrap><INPUT class=SAPBEXTxtFldright id=DATA_ROW_FROM title="Zeile - Maximale Anzahl: 170" onchange=document.SAPBWUForm5.submit() size=3 value=1 name=DATA_ROW_FROM></TD>
<TD class=SAPBEXTxtStd noWrap>/ 170 </TD>
<TD class=SAPBEXTxtStd noWrap><A title="Nächste Zeilen" href="JavaScript:SAPBW(5,'','','68')"><IMG title="Nächste Zeilen" alt="Nächste Zeilen" src="/sap/bw/Mime/BEx/Icons/page_down.gif" border=0></A></TD>
<TD class=SAPBEXTxtStd noWrap><A title="Letzte Zeile" href="JavaScript:SAPBW(5,'','','170')"><IMG title="Letzte Zeile" alt="Letzte Zeile" src="/sap/bw/Mime/BEx/Icons/page_last_row.gif" border=0></A></TD></TR></TBODY></TABLE></TD></FORM></TR></TBODY></TABLE></TD></TR>
<TR></TR>
<TR>
<TD class=SAPBEXchaText noWrap>Profit Center</TD>
<TD class=SAPBEXchaText noWrap>Projektleiter</TD>
<TD class=SAPBEXchaText noWrap colSpan=2>Projekt</TD>
<TD class=SAPBEXchaText noWrap>akt. Status</TD>
<TD class=SAPBEXchaText noWrap>akt. Status Dat.</TD>
<TD class=SAPBEXchaText noWrap>Kredit Datum</TD>
<TD class=SAPBEXchaText noWrap>letzte Buchung</TD>
<TD class=SAPBEXstdItem noWrap>Kredit</TD>
<TD class=SAPBEXstdItem noWrap>Ist Q1 2010</TD>
<TD class=SAPBEXstdItem noWrap>Ist Q2 2010</TD>
<TD class=SAPBEXstdItem noWrap>Ist Q3 2010</TD>
<TD class=SAPBEXstdItem noWrap>Ist Q4 2010</TD>
<TD class=SAPBEXstdItem noWrap>Kredit %</TD>
<TD class=SAPBEXstdItem noWrap>FC Q3</TD>
<TD class=SAPBEXstdItem noWrap>FC Q4</TD>
<TD class=SAPBEXstdItem noWrap>Projektende</TD>
<TD class=SAPBEXstdItem noWrap>Alert</TD>
<TD class=SAPBEXstdItem noWrap>Notizen</TD></TR>
<TR>
<TD class=SAPBEXstdItem noWrap rowSpan=7>PC100</TD>
<TD class=SAPBEXstdItem noWrap rowSpan=3>Ammann Conrad</TD>
<TD class=SAPBEXstdItem noWrap>G000034</TD>
<TD class=SAPBEXstdItem noWrap>Techn. Zusammenarbeit China</TD>
<TD class=SAPBEXstdItem noWrap>k.a.</TD>
<TD class=SAPBEXstdItem noWrap>#</TD>
<TD class=SAPBEXstdItem noWrap>#</TD>
<TD class=SAPBEXstdItem noWrap>#</TD>
<TD class=SAPBEXstdData title=0 noWrap>0</TD>
<TD class=SAPBEXstdData noWrap> </TD>
<TD class=SAPBEXstdData noWrap> </TD>
<TD class=SAPBEXstdData noWrap> </TD>
<TD class=SAPBEXstdData title=0 noWrap>0</TD>
<TD class=SAPBEXstdData noWrap> </TD>
<TD class=SAPBEXstdData noWrap> </TD>
<TD class=SAPBEXstdData noWrap> </TD>
<TD class=SAPBEXstdData noWrap> </TD>
<TD class=SAPBEXstdData noWrap>I NEED THIS ONE (9th) of every Data Row</TD>
<TD class=SAPBEXstdData title=0 noWrap>
<DIV class=notiz style="TEXT-ALIGN: left"></DIV></TD></TR>
<TR>
<TD class=SAPBEXstdItem noWrap>G000164</TD>
<TD class=SAPBEXstdItem noWrap>Tag der offenen Tür</TD>...
........
Try and put input in front of your selector (like input[name=TABLE_1] tr
), because it may be that jQuery is looking through every element, including spans, divs, h1s, etc...
$('[name=TABLE_1] tr') seems invalid because TABLE or TBODY don't have any NAME attribute (correct me if I'm wrong).
Two different solutions:
- If it ain't broke, don't fix it: stay with jQuery 1.4.2. or...
- Rewrite the selector so that it selects more efficiently. Start with
$('table[name=TABLE_1] tr')
, and use a more specific selector in.find()
- perhaps use.children()
instead of.find()
? Would need to see the actual markup for more specific suggestions.
Edit Your markup is horribly invalid. form
is not a valid child of table
, name
is not a valid attribute of table
(as pointed out by @Capsule), you're not using nowrap
correctly... I recommend that you familiarize yourself with the W3C Validator and go from there.
精彩评论