Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

In developing some server side validation I discovered that (the latest Windows versions as of this writing of) Firefox, Chrome and Internet Explorer handle vertical tab characters differently in input type=text form fields.

I had a hard time trying to paste the character into any of the browsers so I used JavaScript to populate the text input on my test form like this:

document.getElementById('theField').setAttribute('value', "hello\vthere");

You can see some of the client side differences in this JSFiddle.

There are differences in how the browsers:

  • display the value in the input field.
  • allow JavaScript to fetch the value back out
  • render the character when used to populate innerHTML of a <pre> tag
  • send the value to the server.

This table below shows what I found:

Browser    | displayed   | put into pre-tag | logged to console | received by server
------------------------------------------------------------------------------------
Chrome     | hello       | hellothere       | hellothere        | hello
------------------------------------------------------------------------------------
Safari     | hello       | hellothere       | hellothere        | hello
------------------------------------------------------------------------------------
Firefox    | hellothere  | hellothere       | hellothere        | hello
  FF cont. |             |                  |                   |      there
------------------------------------------------------------------------------------
IE         | hello there | hello there      | hello             | hello
  IE cont. |             |                  |   there           |      there
------------------------------------------------------------------------------------
Opera      | hellothere  | hello            | hello             | hello
  Op cont. |             | there            | there             |      there

For the console I used each browser's built in developer tools (I couldn't get the JSFiddle to work with Firebug).

Is there a specification on how browsers are supposed to handle this character in this type of form field? If so what is the specification and which browser is following it?

share|improve this question
    
I know the vertical tab is considered an illegal character in XML and good parsers will reject a document containing them as malformed. I couldn't see anything regarding HTML/SGML parsers so i'd assume "undocumented" –  Dan Jul 23 '13 at 15:16
add comment

1 Answer

I couldn't find an HTML or HTTP specification that specifically disallows the vertical tab in form input values. But based on indirect information Firefox, I.E. and Opera appear to be more correct.

The input value can be thought of as an element attribute value in which case it falls under the definition of an attribute value. The HTML5 draft spec. says that attribute values "are a mixture of text and character references, except with the additional restriction that the text cannot contain an ambiguous ampersand."

Their definitions of "text" and "character references" don't specifically exclude the vertical tab . By my reading this suggests that it is allowed.

Also, chromium developers have agreed that this is an issue and are working to address it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.