Bug Tracker

Modify

Ticket #8641 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

jQuery 1.5.x bug when trying to get fields with names that have points as separator

Reported by: gabrielmoreira@… Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocking: Blocked by:

Description

This sample works on 1.4.x

<html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
  <input type='text' name='foo.bar'/>
  <script>
    $(document).ready(function() {
        console.log($('*[name=foo.bar]'));
    });
  </script>
</body>
</html>

But doesn't work on 1.5.x

<html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
  <input type='text' name='foo.bar'/>
  <script>
    $(document).ready(function() {
        console.log($('*[name=foo.bar]'));
    });
  </script>
</body>
</html>

Change History

comment:1 Changed 2 years ago by timmywil

As you can see from the docs ( http://api.jquery.com/attribute-equals-selector/), quotes are mandatory for attribute selectors. This has always been the case, but did work in 1.4, and now has been fixed. Attribute selectors that are only one word will still work, but any selectors separated by period or a space or certain other breaks will fail. See  http://jsfiddle.net/timmywil/X8MwL/

comment:2 Changed 2 years ago by dmethvin

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

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.