Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

2.4.5 String.prototype HTML Wrapper Properties

JScript 5.x 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 obmitted. 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).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.