#1004 ✓ fixed_in_master_branch
Serkan Yerşen

select method throws error when used on FORM elements

Reported by Serkan Yerşen | March 3rd, 2010 @ 02:02 PM

I recently noticed that if you use selector method directly on form elements, it throws error. Such as:

HTML code

<form id='my_form' action="some_page.html">
  <input type="text" name="firstName">
  <input type="text" name="lastName">
  <button type="submit">Submit</button>
</form>

Javascript

$('my_form').select('input');

I dug into the code and made some research, it turns out it's a problem with selectorsAPI. API doesn't allow you to use "#id selector" structure on FROM elements, they should be treated like document object. So I made a quick patch and fixed this problem.

  findElements: function(root) {
...
     case 'selectorsAPI':
3293:    if (root !== document && root.nodeName !== 'FORM') {
...
  },

I know you are switching to sizzle.js but I though this may help someone out there.

Comments and changes to this ticket

  • Tobie Langel

    Tobie Langel March 4th, 2010 @ 07:12 AM

    • State changed from “new” to “fixed_in_master_branch”

    Thanks for your ticket.

    This should be fixed in the current master branch.

    You may build Prototype from source or wait until our next official release to benefit from it.

    I am closing this ticket as fixed_in_master_branch. Thank you for your understanding.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket

Pages