Invalid DOM IDs #131

Closed
grimen opened this Issue Nov 22, 2009 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

grimen commented Nov 22, 2009

Not sure what this does in practice, but I'm 99% sure a numeric value only is not a valid XHTML class:

li_options = value_as_class ? { :class => value.to_s.downcase } : {}

Makes Nokogiri XML parser to puke too...

A prefix would solve this, but I'm not sure if that would mess upp things. Specs seems to pass with a small fix, but anyway.

Contributor

grimen commented Nov 22, 2009

This line seems to be invalid as well:

output_buffer.should_not have_tag('form fieldset.inputs #post[author]_1_login_input')

I dont' get that one either. Justin?

Owner

justinfrench commented Nov 22, 2009

José added that in, and I believe it was there primarily for an array of string values or similar. It's a good idea, but obviously the onus is on the author to make sure they only use it when the values are suited as class names, rather than the onus being on Formtastic to ensure validity.

We basically need to sanitize the strings, but I'm not in that much of a hurry :)

Contributor

grimen commented Nov 22, 2009

Without valid XHTML Nokogiri won't work, so migrating to the newer rspec matchers won't be a good idea then. I do feel that valid XHTML should be a high priority goal though; #post[author]_1_login_input is not a valid DOM ID for sure:

Should match:

[A-Za-z][-A-Za-z0-9_:.]+

Contributor

grimen commented Dec 2, 2009

Replacing dependency rspec_hpricot_matchers (Hpricot) with rspec_tag_matchers (Nokogiri); specs runs faster, and rspec_hpricot_matchers was not really maintained anymore + Nokogiri is more live project. Also fixed generation of invalid DOM for radio_input/check_boxes input types. Closed by ca12563.

Owner

justinfrench commented Dec 2, 2009

pulled in, closing.

@zuf zuf pushed a commit to zuf/formtastic that referenced this issue Sep 7, 2012

@grimen @justinfrench grimen + justinfrench Replacing dependency rspec_hpricot_matchers (Hpricot) with rspec_tag_…
…matchers (Nokogiri); specs runs faster, and rspec_hpricot_matchers was not really maintained anymore + Nokogiri is more live project. Also fixed generation of invalid DOM for radio_input/check_boxes input types. Closes #131.
ca12563

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment