By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,256 Members | 1,700 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,256 IT Pros & Developers. It's quick & easy.

Access to input type - cross-browser

P: n/a
I see some people accessing a forms' input type without converting
toLowerCase() and others do. Do some browser's return type as
uppercase?

This
document.forms['myFormName'].elements['myElementName'].type=='select-one';

or this
document.forms['myFormName'].elements['myElementName'].type.toLowerCase()=='select-one';

Somewhat related, what about when tag names and events...does case
matter?

Thanks

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
johkar wrote:
I see some people accessing a forms' input type without converting
toLowerCase() and others do. Do some browser's return type as
uppercase?

This
document.forms['myFormName'].elements['myElementName'].type=='select-one';

or this
document.forms['myFormName'].elements['myElementName'].type.toLowerCase()=='select-one';

Somewhat related, what about when tag names and events...does case
matter?


DOM Level 3:

1.3.1 String Comparisons in the DOM

The DOM has many interfaces that imply string matching. For

XML, string comparisons are case-sensitive and performed with a

binary comparison of the 16-bit units of the DOMStrings .
However, for case-insensitive markup languages, such as HTML
4.01 or earlier, these comparisons are case-insensitive where
appropriate.

Note that HTML processors often perform specific case
normalizations (canonicalization) of the markup before the DOM

structures are built. This is typically using uppercase for
element names and lowercase for attribute names. For this
reason, applications should also compare element and attribute
names returned by the DOM implementation in a case-insensitive
manner.

<URL:http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Core-DOMObject>
I think the last sentence is very important to your question.

--
Fred
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.