Re: [Rails-core] Unicode symbols in id attributes of input tags

57 views
Skip to first unread message

Aaron Patterson

unread,
May 3, 2013, 1:21:39 PM5/3/13
to rubyonra...@googlegroups.com
On Fri, May 03, 2013 at 05:02:54AM -0700, Дмитрий Жлобо wrote:
>
>
> HTML5 standard allow to use unicode symbols in id attributes. Blog post
> about this: http://mathiasbynens.be/notes/html5-id-class and html standard
> page:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#the-id-attribute
>
> Now any not alphanumeric symbol translates to underscores. I want to change
> behavior of id sanitazer. What do you think about this?

Can you show us a code example of what you mean? Which code is
translating them to underscores?

--
Aaron Patterson
http://tenderlovemaking.com/

Dmitry Zhlobo

unread,
May 4, 2013, 9:14:55 AM5/4/13
to rubyonra...@googlegroups.com
For example:

text_field_tag('search[Модель авто]') # => <input id="search____________" name="search[Модель авто]" type="text" />.

I suppose it is because in html4 id attribute"must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")" (http://www.w3.org/TR/html4/types.html#type-name).

Since html5 we have no restrictions like that: http://www.w3.org/TR/html5/dom.html#the-id-attribute. I want to change behavior of santizer for id attribute. @nashby pointed me on that method: https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/form_tag_helper.rb#L779-782


2013/5/3 Aaron Patterson <tende...@ruby-lang.org>

Rafael Mendonça França

unread,
May 4, 2013, 9:20:10 AM5/4/13
to rubyonra...@googlegroups.com
I don't see any reason why we can't change this. I think we can proceed unless someone else have a good reason to not.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Steve Schwartz

unread,
May 4, 2013, 11:40:55 AM5/4/13
to rubyonra...@googlegroups.com
I don't think it'd be necessary, but if we need to change jquery-ujs for this as well, please let me know.

-- Steve Schwartz

Aaron Patterson

unread,
May 4, 2013, 3:53:51 PM5/4/13
to rubyonra...@googlegroups.com
On Sat, May 04, 2013 at 04:14:55PM +0300, Dmitry Zhlobo wrote:
> For example:
>
> text_field_tag('search[Модель авто]') # => <input id="search____________"
> name="search[Модель авто]" type="text" />.
>
> I suppose it is because in html4 id attribute"must begin with a letter
> ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]),
> hyphens ("-"), underscores ("_"), colons (":"), and periods (".")" (
> http://www.w3.org/TR/html4/types.html#type-name).
>
> Since html5 we have no restrictions like that:
> http://www.w3.org/TR/html5/dom.html#the-id-attribute. I want to change
> behavior of santizer for id attribute. @nashby pointed me on that method:
> https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/form_tag_helper.rb#L779-782

Yes, we should definitely fix this. Can you work up a patch?

Dmitry Zhlobo

unread,
May 5, 2013, 10:21:08 AM5/5/13
to rubyonra...@googlegroups.com
Yes, I will work on it.


2013/5/4 Aaron Patterson <tende...@ruby-lang.org>
Reply all
Reply to author
Forward
0 new messages