Bug Tracker

Opened 14 years ago

Closed 14 years ago

#4099 closed bug (wontfix)

Basic #id selector fails after multiple dynamic html insert

Reported by: Mongi Owned by: john
Priority: major Milestone: 1.3.2
Component: selector Version: 1.3.1
Keywords: #id, selector, dynamic, insert Cc:
Blocked by: Blocking:


Hi! I tried to upgrade from 1.2.6 to 1.3.1 and encountered a bug in selectors.

I make a function that inserts div#par with another child div#chi using .after() function. Then i call $("div#par div#chi").length and get normal value of 1. Afterwards I call the same function and it inserts div#par1 with child div#chi. But now the call $("div#par div#chi").length returns value of 0. Meanwhile $("div#par div[id=chi]") works fine.

This bug appears at least in 1.3.1 version and under all browsers except Chrome In JQuery branch 1.2.x there is no such bug.

Demo of 1.2.6: http://mongi.ru:8080/bug/jq127.html

Demo of 1.3.1: http://mongi.ru:8080/bug/jq131.html

Attachments (1)

bug.zip (49.8 KB) - added by Mongi 14 years ago.

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by Mongi

Attachment: bug.zip added

comment:1 Changed 14 years ago by john

Resolution: wontfix
Status: newclosed

This has to do with the fact that we're using getElementById to find the first matched element on the page - thus we can only find the first element with that ID on the page (and you have multiple elements with the same ID). I recommend generating new, unique, IDs or using [id=NAME].

Note: See TracTickets for help on using tickets.