Bug Tracker

Modify

Ticket #989 (closed bug: invalid)

Opened 6 years ago

Last modified 6 years ago

#-starting IDs are not found in the page

Reported by: dialtone Owned by:
Priority: major Milestone: 1.1.2
Component: core Version: 1.1.1
Keywords: Cc:
Blocking: Blocked by:

Description

$('<li id="#foo">hi</li>').appendTo("body"); $("##foo")

Doesn't find the just added li item.

Change History

comment:1 Changed 6 years ago by aercolino

# is not a valid id starter: When defining fragment identifiers to be backward-compatible, only strings matching the pattern [A-Za-z][A-Za-z0-9:_.-]* should be used

see:  http://www.w3.org/TR/html4/types.html#h-6.2

comment:2 follow-up: ↓ 3 Changed 6 years ago by john

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

aercolino is correct. We only accept IDs that are valid both in HTML documents and for CSS selectors.

comment:3 in reply to: ↑ 2 Changed 6 years ago by aheimlich

Replying to john:

Just to clarify, this means that you should should not use #, ., or : in your IDs as they are a part of CSS selector syntax, so the pattern becomes this:

[A-Za-z][A-Za-z0-9_-]*

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.