Export (0) Print
Expand All

2.8.4 String.prototype HTML Wrapper Properties

Internet Explorer ECMAScript defines String.prototype functions that wrap the string value of a this value with an HTML tag. The following abstraction is used to specify the behavior of these functions.

The abstract operation WrapWithHTML is called with arguments body, tag, attribute, and data. The tag and attribute arguments must be strings; attribute and data may be omitted. The following steps are performed:

  1. Append the character "<" to the characters of tag.

  2. If attribute is not present, go to Step 7.

  3. Append to Result(1) a single-space character followed by the characters of attribute.

  4. Append to Result(3) the characters "=" and """.

  5. Append to Result(4) the characters of the string returned by ToString(data).

  6. Append to Result(5) the character """.

  7. If attribute is present, use Result(6); otherwise, use Result(1).

  8. Append to Result(7) the character ">".

  9. Append to Result(8) the characters of the string returned by ToString(body).

  10. Append to Result(9) the characters "<" and "/".

  11. Append to Result(10) the characters of tag.

  12. Append to Result(11) the character ">".

  13. Return the string value of the characters from Result(12).

Show:
© 2014 Microsoft