Unsafe Names for HTML Form Controls

Conclusion

Problem

Browser APIs and Web Standards are designed in such a way that element ids and names, if not carefully chosen, may inadvertently pollute other objects with extra properties. This can cause problems.

Solution

There are several steps that you, as a page author, can take to avoid these problems.

Do Web Standards Suck?

They are not without their problems. Most of the problems and misconceptions would become self-evident if the standards bodies were to use a test-driven approach. The current approach is Big Up Front Design with the traditional analysis-documentation-implementation phases. The APIs are designed with a waterfall approach.

Testing is informal and not part of the official process. This is something that needs to change in order to avoid unforseen pitfalls. Unfortunately, there has not been enough change in this direction and we can witness current problems with HTML 5 that build upon the mistakes of prior specifications and poor design of experimental implementations.

A test-based process could have revealed the design problem with form-as-a-collection, as specified in HTML 5, or the issues with body event handler content attributes (e.g. hashchange). Multiple contributors to a test suite would make it hard for the author to ignore API design mistakes.

Normative References

Table of Contents