Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13201 closed bug (notabug)

unbind click error

Reported by: pixecs1 Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:

Description

Hello, i created a sample page to show a little bug when unbinding a event. When "$this.unbind('click');" is commented the code work as expected


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Freelancer projects</title>
		<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
    </head>
	<body>
        <div id="MainDiv">
            <a href="javascript:void(0)">Button 1</a>
            <a href="javascript:void(0)">Button 2</a>
            <a href="javascript:void(0)">Button 3</a>   
        </div>
		<script type="text/javascript">
            jQuery(document).ready(function(){
                jQuery('#MainDiv a').unbind('click').bind('click', function(){
                    var $Button = jQuery(this);
                    jQuery('#MainDiv a').each(function(){
                        var $this = jQuery(this);
                        //console.log($this[0] != $Button[0]);
                        if($this[0] != $Button[0])
                        {
                            $this.unbind('click');
                            $this.removeClass('pbbutton_blue');
                        }
                    });
                }) ;
            });
		</script>
	</body>
</html>

Change History (2)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

Please ask for help on the forum. You're misunderstanding the meaning of equality.

comment:2 in reply to:  1 Changed 7 years ago by pixecs1

Replying to dmethvin:

Please ask for help on the forum. You're misunderstanding the meaning of equality.

Hello, i'm not misunderstanding the equality (it's checking if the source html elemets are the same), and my point is that the $this.unbind('click'); line trigger a crash on line 1719 in jquery source.

Note: See TracTickets for help on using tickets.