Django

Code

Ticket #8440 (closed: invalid)

Opened 4 months ago

Last modified 4 months ago

Change forms default auto_id='id-%s'

Reported by: cdleary@gmail.com Assigned to: cdleary
Milestone: post-1.0 Component: Forms
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

auto_id.diff (2.1 kB) - added by cdleary@gmail.com on 08/20/08 02:20:36.
Simple proposal auto_id patch.

Change History

08/20/08 02:20:36 changed by cdleary@gmail.com

  • attachment auto_id.diff added.

Simple proposal auto_id patch.

08/20/08 03:17:59 changed by Daniel Pope <dan@mauveinternet.co.uk>

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

08/20/08 03:45:08 changed 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:

08/20/08 03:51:16 changed by Daniel Pope <dan@mauveinternet.co.uk>

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

08/20/08 05:14:45 changed by julianb

  • status changed from assigned to closed.
  • resolution set to invalid.
  • milestone set to post-1.0.

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.


Add/Change #8440 (Change forms default auto_id='id-%s')




Change Properties
Action