Unsafe Names for HTML Form Controls
Unsafe Names
There are roughly three-hundred (300) names which a form control
must not have.
Unsafely named elements can be added to a FORM
object after
the form has been created, or can be included in the HTML source
code.
Examples of Unsafe Form Control Names
Unsafe FORM
control names can appear in three ways:
- In the HTML Source
- Added via the DOM
- From changing the
name
property
Not all browsers behave the same when using unsafe
FORM
control names and a changing DOM.
Solution: Namespaced Form Controls
A naming system can help avoid unsafe names.
Name the form controls starting with a special prefix. The prefix should be
unique and represent the application.
For example, an application named "VortexMail" could use the prefix vtxmail_
.
<input name="vtxmail_fname" type="text">
<input name="vtxmail_data" type="file">
<input name="vtxmail_submit" type="submit">
A prefix can also act as an identifying characteristic of your program or company,
like a namespace.
Unsafe Names - Partial List
This list contains all the names that a form control should never have. It assumes
that event handler attributes are never used and excludes some
proposed properties from HTML 5
[References]. (e.g.
autofocus
, min
, max
,
height
, labels
, required
, valid
, etc.).
If event handler attributes are used, the list of unsafe names also includes
every possible property name that exists on document
, window
,
and the object of the tag that the event handler is declared on (could be any tag).
This would bring the list to well over five-hundred (500) unsafe names, including
atob
, bgColor
, clear
, close
, opener
,
status
, write
, etc.
-
ATTRIBUTE_NODE
-
CDATA_SECTION_NODE
-
COMMENT_NODE
-
DOCUMENT_FRAGMENT_NODE
-
DOCUMENT_NODE
-
DOCUMENT_POSITION_CONTAINED_BY
-
DOCUMENT_POSITION_CONTAINS
-
DOCUMENT_POSITION_DISCONNECTED
-
DOCUMENT_POSITION_FOLLOWING
-
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
-
DOCUMENT_POSITION_PRECEDING
-
DOCUMENT_TYPE_NODE
-
ELEMENT_NODE
-
ENTITY_NODE
-
ENTITY_REFERENCE_NODE
-
NOTATION_NODE
-
PROCESSING_INSTRUCTION_NODE
-
TEXT_NODE
-
accept
-
acceptCharset
-
action
-
addBehavior
-
addEventListener
-
addEventSource
-
addRepetitionBlock
-
addRepetitionBlockByIndex
-
all
-
appendChild
-
applyElement
-
ariaBusy
-
ariaChecked
-
ariaControls
-
ariaDescribability
-
ariaDisabled
-
ariaExpanded
-
ariaFlowto
-
ariaHaspopup
-
ariaHidden
-
ariaInvalid
-
ariaLabelledby
-
ariaLevel
-
ariaMultiselect
-
ariaOwns
-
ariaPosinset
-
ariaPressed
-
ariaReadonly
-
ariaRequired
-
ariaSecret
-
ariaSelected
-
ariaSetsize
-
ariaValuemax
-
ariaValuemin
-
ariaValuenow
-
attachEvent
-
attributes
-
autocomplete
-
baseURI
-
behaviorUrns
-
blockDiraction
-
blur
-
canHaveChildren
-
canHaveHTML
-
checkValidity
-
childElementCount
-
childNodes
-
children
-
className
-
clearAttributes
-
click
-
clientHeight
-
clientLeft
-
clientTop
-
clientWidth
-
cloneNode
-
compareDocumentPosition
-
componentFromPoint
-
constructor
-
contains
-
contentEditable
-
currentStyle
-
data
-
detachEvent
-
dir
-
dispatchEvent
-
dispatchFormChange
-
dispatchFormInput
-
document
-
dragDrop
-
elements
-
encoding
-
enctype
-
fireEvent
-
firstChild
-
firstElementChild
-
focus
-
getAdjacentText
-
getAttribute
-
getAttributeNS
-
getAttributeNode
-
getAttributeNodeNS
-
getBoundingClientRect
-
getClientRects
-
getElementsByClassName
-
getElementsByTagName
-
getElementsByTagNameNS
-
getExpression
-
getFeature
-
getUserData
-
hasAttribute
-
hasAttributeNS
-
hasAttributes
-
hasChildNodes
-
hasOwnProperty
-
hideFocus
-
id
-
innerHTML
-
innerText
-
insertAdjacentElement
-
insertAdjacentHTML
-
insertAdjacentText
-
insertBefore
-
isContentEditable
-
isDefaultNamespace
-
isDefaultNamespaceURI
-
isDisabled
-
isEqualNode
-
isMultiLine
-
isPrototypeOf
-
isSameNode
-
isSupported
-
isTextEdit
-
item
-
lang
-
language
-
lastChild
-
lastElementChild
-
length
-
localName
-
lookupPrefix
-
mergeAttributes
-
method
-
moveRepetitionBlock
-
msBlockProgression
-
msBoxSizing
-
name
-
namedItem
-
namespaceURI
-
nextSibling
-
nodeName
-
nodeType
-
nodeValue
-
normalize
-
offsetHeight
-
offsetWidth
-
onOffBehavior
-
onabort
-
onactivate
-
onbeforeactivate
-
onbeforecopy
-
onbeforecut
-
onbeforedeactivate
-
onbeforeeditfocus
-
onbeforepaste
-
onblur
-
onchage
-
onclick
-
onclosecapture
-
oncontextmenu
-
oncopy
-
oncut
-
ondblclick
-
ondeactivate
-
ondrag
-
ondragend
-
ondragenter
-
ondragleave
-
ondragover
-
onerror
-
onfocus
-
onfocusin
-
onfocusout
-
onhelp
-
oninput
-
onkeydown
-
onkeypress
-
onkeyup
-
onmousedown
-
onmouseenter
-
onmouseleave
-
onmousemove
-
onmousemultiwheel
-
onmouseout
-
onmouseover
-
onmouseup
-
onmousewheel
-
onmove
-
onmoveend
-
onmovestart
-
onpaste
-
onpropertychange
-
onreadystatechange
-
onresize
-
onresizeend
-
onresizestart
-
onscroll
-
onsearch
-
onselect
-
onselectstart
-
ontimeerror
-
onunload
-
outerHTML
-
outerText
-
ownerDocument
-
parentNode
-
parentTextEdit
-
prefix
-
previousElementSibling
-
previousSibling
-
propertyIsEnumerable
-
querySelector
-
querySelectorAll
-
quotes
-
releaseCapture
-
removeAttribute
-
removeAttributeNS
-
removeAttributeNode
-
removeBehavior
-
removeChild
-
removeEventListener
-
removeEventSource
-
removeExpression
-
removeNode
-
removeRepetitionBlock
-
repeatMax
-
repeatMin
-
repeatStart
-
repetitionBlocks
-
repetitionIndex
-
repetitionTemplate
-
repetitionType
-
replace
-
replaceAdjacentText
-
replaceChild
-
replaceNode
-
reset
-
resetFromData
-
role
-
runtimeStyle
-
schemaTypeInfo
-
scopeName
-
scrollByLines
-
scrollByPages
-
scrollHeight
-
scrollIntoView
-
scrollLeft
-
scrollTop
-
scrollWidth
-
selectNodes
-
selectSingleNode
-
setActive
-
setAttributeNS
-
setAttributeNode
-
setAttributeNodeNS
-
setCapture
-
setExpression
-
setIdAttribute
-
setIdAttributeNS
-
setIdAttributeNode
-
setUserData
-
sourceIndex
-
spellcheck
-
style
-
submit
-
swapNode
-
tabIndex
-
tagName
-
tagUrn
-
target
-
templateElements
-
text
-
textContent
-
title
-
toLocaleString
-
toString
-
uniqueID
-
unselectable
-
unwatch
-
urns
-
valueOf
-
watch
-
window
Early Adopter
Safari 3 has implemented the behavior specified in more closely than
Safari 2. Safari 3 replaces more pre-existing properties of a
FORM
when an element with the same name is added.
Table of Contents