Bug Tracker

Opened 11 years ago

Closed 11 years ago

#8641 closed bug (fixed)

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

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

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 (2)

comment:1 Changed 11 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 11 years ago by dmethvin

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.