📜 ⬆️ ⬇️

A small note for those who move to 1.4.3

Feature in 1.4.3 - manifested in FF3.6.11

A simple example:
<table> <tr> <td myAttr='1'>1.1</td> <td>1.2</td> <td>1.3</td> <td myAttr='1'>1.4</td> </tr> <tr> <td myAttr='1'>2.1</td> <td>2.2</td> <td>2.3</td> <td myAttr='1'>2.4</td> </tr> </table> 


Previously, before 1.4.3, the result of executing the following jQuery instruction was 2 (elements 1.2 and 1.3 were selected)
  $('tr').eq(0).find('td').eq(0).nextUntil('td[myattr=1]').length 

')
In 1.4.3, the result will be equal to ... 3 (elements 1.2, 1.3 and 1.4 are selected).
Apparently, the point is to change the jQuery search algorithms namely, the transition to the use of matchesSelector. To return the behavior in the right direction, you need to take the value of the attribute in quotes:

  $('tr').eq(0).find('td').eq(0).nextUntil('td[myattr="1"]').length 


Easy debugging for you,%% username!

UPD : What is interesting is that IE8 (and most likely IE <9) is not subject to a “bug”. It simply does not implement matchesSelector!

UPD : There is a suspicion that this is a bug in FF3.6.11. In Chrome7 (it has a matchesSelector!), The bug is not reproduced.

Source: https://habr.com/ru/post/106865/


All Articles