Home > Articles

  • Print
  • + Share This
This chapter is from the book

Script and Style Data

When working with scripts, certain concerns arise as to how those scripts are managed. Several important points of which to be aware include

  • Script data must not be interpreted as HTML or XHTML. Rather, it is passed on as data to a script engine. For the developer, this means authoring scripts in documents must conform to the specification in order to avoid problems. For the browser manufacturer, this means that they must be written so script data is appropriately passed to the available engine.

  • Case sensitivity with scripts is dependent upon the language. In HTML, you can have mixed case scripts. However, this becomes an issue in XHTML. Because XHTML is case-specific, you'll have to modify case concerns when authoring XHTML, so getElementByID will have to be written getelementbyid.

  • Script data that relates to an element may not contain character entities. Script data corresponding to an attribute may do so.

Read about working with scripts in "Adding Scripting to HTML and XHTML Documents," p. 401, Chapter 16.

In most instances, style data is dealt with just as script data is. In an HTML or XHTML document, style is defined in the head via the style element, or inline, within the document via the style attribute. User agents should never try to interpret style data as HTML.

As with script data, style data case concerns depend on the style sheet language, and the author's conventions. And, as with script data, element-related style may not contain character entities, whereas attribute-related style may do so.

For more information about style, please see "Using CSS with HTML and XHTML," p. 345, Chapter 14.

  • + Share This
  • 🔖 Save To Your Account