Bug Tracker

Modify

Ticket #2511 (closed bug: wontfix)

Opened 5 years ago

Last modified 5 years ago

Attribute Selector Sometimes returns function instead of string

Reported by: Pete Michaud Owned by:
Priority: major Milestone: 1.2.4
Component: core Version: 1.2.3
Keywords: Cc:
Blocking: Blocked by:

Description

I'm working on an ASP .NET application, and I wanted to select all controls that post back, so I used this selector:

$("input[onchange='doPostBack']").change(function(){

setTimeout(WaitForPostBack, 250);

});

The idea is to trigger a "please wait" dialog while the page takes it's sweet time posting back.

The part that's broken is that because I'm looking for onclick, and the event itself is onclick, when it hits around line 1712:

if ( (type == "" && !!z 1710 type == "=" && z == m[5]1711 type == "!=" && z != m[5]1712 type == "=" && z && !z.indexOf(m[5]) 1713 type == "$=" && z.substr(z.length - m[5].length) == m[5]1714 (type == "*="
type == "~=") && z.indexOf(m[5]) >= 0) not )

1715 tmp.push( a );

z.indexOf breaks, because z is an anonymous function, instead of the string value of the "onclick" attribute. The anonymous function obviously doesn't have the indexOf method.

Change History

comment:1 Changed 5 years ago by flesler

  • Status changed from new to closed
  • Resolution set to wontfix

This could be patched, but it seems like it just adds unnecessary overhead. Use a filter function instead.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.