[drupal-devel] [bug] Brackets should not be used in IDs (primary
offender: form_ functions)
killes
drupal-devel at drupal.org
Mon Apr 4 23:50:02 UTC 2005
Issue status update for http://drupal.org/node/19986
Project: Drupal
-Version: 4.5.2
+Version: cvs
Component: base system
Category: bug reports
Priority: critical
-Assigned to: Anonymous
+Assigned to: killes at www.drop.org
Reported by: factoryjoe
Updated by: killes at www.drop.org
-Status: active
+Status: patch
Attachment: http://drupal.org/files/issues/valid-forms.patch (5.95 KB)
Ok, here is an initial patch. The patch needs testing.
I introduced a new function _form_get_id that is supposed to replace
any non-allowed characters by a dash. This is not really nice, as we
will get CSS IDs that have double dashes, but it is valid. We cannot
simply reduce the double dashes to single dashes because there already
might be another ID with only a single dash.
killes at www.drop.org
Previous comments:
------------------------------------------------------------------------
April 4, 2005 - 23:41 : factoryjoe
Attachment: http://drupal.org/files/issues/blah.html (1.13 KB)
Square brackets in IDs are not valid XHTML and cause a host of problems
when trying to style individual elements. I have attached a page that
proves this.
Additionally, when you try to style an element by an ID that contains
brackets, *all other styling from that rule will be ignored*. Brackets
are simply not valid characters for IDs [1] (/emphasis added/):
There's also a difference between CLASS and ID attributes as regards to
the allowable format of values. By HTML rules, CLASS is CDATA, which
basically means 'anything goes', but CSS rules impose some
restrictions. /And by HTML rules, ID is ID, which means that only
letters of the English alphabet ([A-Za-z]), digits ([0-9]), hyphens
("-"), underscores ("_"), colons (":"), and periods (".") are
permitted, and the first character must be a letter (and underscores
don't work reliably)/
"
If you validate the attached document, you will get these two errors:
XHTML validation error
Line 25, column 19: character "]" is not allowed in the value of
attribute "id"
<div id="edit-16188][weight">
CSS validation errors
Line: 17 Context : #edit-16188
Parse Error - #edit-16188][weight {
border: 2px solid blue;
}
Line: 20 Context : #edit-16188
Parse Error - #edit-16188][weight, #test-2 {
border: 2px solid green;
}
[1] http://css.nu/faq/ciwas-aFAQ.html#QA14
More information about the drupal-devel
mailing list