Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#8440 closed (invalid)

Change forms default auto_id='id-%s'

Reported by: cdleary@… Owned by: cdleary
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hey all,

I don't think that the default auto_id for form fields is compatible with CSS1, since it starts with "id_". A la http://www.w3.org/TR/REC-CSS1#appendix-b:

unicode		\\[0-9a-f]{1,4}
latin1		[¡-ÿ]
escape		{unicode}|\\[ -~¡-ÿ]
stringchar	{escape}|{latin1}|[ !#$%&(-~]
nmstrt		[a-z]|{latin1}|{escape}
nmchar		[-a-z0-9]|{latin1}|{escape}
ident		{nmstrt}{nmchar}*
name		{nmchar}+

I believe it's a real simple patch (attached), but I haven't tested it rigorously.

Cheers,

Chris

Attachments (1)

auto_id.diff (2.1 KB) - added by cdleary@… 7 years ago.
Simple proposal auto_id patch.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by cdleary@…

Simple proposal auto_id patch.

comment:1 Changed 7 years ago by Daniel Pope <dan@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

That's an error in CSS1. It's fixed in CSS 2.1. The HTML is legal.

comment:2 Changed 7 years ago by cdleary

  • Owner changed from nobody to cdleary
  • Status changed from new to assigned

I figured the HTML was legal, but was questioning whether all browsers targeted by the Django framework support it as a CSS identifier. There are two different concerns, right?

As Dan said, w3c corrected it in CSS2.1 -- it's not in the CSS2 grammar either:

comment:3 Changed 7 years ago by Daniel Pope <dan@…>

In my experience all browsers have supported _ in selectors for as long as I can remember.

comment:4 Changed 7 years ago by julianb

  • milestone set to post-1.0
  • Resolution set to invalid
  • Status changed from assigned to closed

If you use a CSS validator, it will tell you there's nothing wrong with id_ selectors even in CSS 1.

The change would be backwards incompatible for no real reason.

comment:5 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top