summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/string-html.tq
blob: 0b0fdfeaef5c5195d944605c544e0c45bc6009da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

namespace string_html {
  extern runtime StringEscapeQuotes(Context, String): String;

  // https://tc39.github.io/ecma262/#sec-createhtml
  transitioning builtin CreateHTML(implicit context: Context)(
      receiver: JSAny, methodName: String, tagName: String, attr: String,
      attrValue: JSAny): String {
    const tagContents: String = ToThisString(receiver, methodName);
    let result = '<' + tagName;
    if (attr != kEmptyString) {
      const attrStringValue: String =
          StringEscapeQuotes(context, ToString_Inline(context, attrValue));
      result = result + ' ' + attr + '=\"' + attrStringValue + '\"';
    }

    return result + '>' + tagContents + '</' + tagName + '>';
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.anchor
  transitioning javascript builtin StringPrototypeAnchor(
      js-implicit context: Context, receiver: JSAny)(...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.anchor', 'a', 'name', arguments[0]);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.big
  transitioning javascript builtin
  StringPrototypeBig(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.big', 'big', kEmptyString, kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.blink
  transitioning javascript builtin
  StringPrototypeBlink(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.blink', 'blink', kEmptyString,
        kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.bold
  transitioning javascript builtin
  StringPrototypeBold(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.bold', 'b', kEmptyString, kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor
  transitioning javascript builtin
  StringPrototypeFontcolor(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.fontcolor', 'font', 'color', arguments[0]);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.fontsize
  transitioning javascript builtin
  StringPrototypeFontsize(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.fontsize', 'font', 'size', arguments[0]);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.fixed
  transitioning javascript builtin
  StringPrototypeFixed(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.fixed', 'tt', kEmptyString, kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.italics
  transitioning javascript builtin
  StringPrototypeItalics(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.italics', 'i', kEmptyString, kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.link
  transitioning javascript builtin
  StringPrototypeLink(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.link', 'a', 'href', arguments[0]);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.small
  transitioning javascript builtin
  StringPrototypeSmall(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.small', 'small', kEmptyString,
        kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.strike
  transitioning javascript builtin
  StringPrototypeStrike(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.strike', 'strike', kEmptyString,
        kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.sub
  transitioning javascript builtin
  StringPrototypeSub(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.sub', 'sub', kEmptyString, kEmptyString);
  }

  // https://tc39.github.io/ecma262/#sec-string.prototype.sup
  transitioning javascript builtin
  StringPrototypeSup(js-implicit context: Context, receiver: JSAny)(
      ...arguments): String {
    return CreateHTML(
        receiver, 'String.prototype.sup', 'sup', kEmptyString, kEmptyString);
  }
}