• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5namespace string {
6extern runtime StringEscapeQuotes(Context, String): String;
7
8// https://tc39.github.io/ecma262/#sec-createhtml
9transitioning builtin CreateHTML(implicit context: Context)(
10    receiver: JSAny, methodName: String, tagName: String, attr: String,
11    attrValue: JSAny): String {
12  const tagContents: String = ToThisString(receiver, methodName);
13  let result = '<' + tagName;
14  if (attr != kEmptyString) {
15    const attrStringValue: String =
16        StringEscapeQuotes(context, ToString_Inline(attrValue));
17    result = result + ' ' + attr + '=\"' + attrStringValue + '\"';
18  }
19
20  return result + '>' + tagContents + '</' + tagName + '>';
21}
22
23// https://tc39.github.io/ecma262/#sec-string.prototype.anchor
24transitioning javascript builtin StringPrototypeAnchor(
25    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
26  return CreateHTML(
27      receiver, 'String.prototype.anchor', 'a', 'name', arguments[0]);
28}
29
30// https://tc39.github.io/ecma262/#sec-string.prototype.big
31transitioning javascript builtin
32StringPrototypeBig(
33    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
34  return CreateHTML(
35      receiver, 'String.prototype.big', 'big', kEmptyString, kEmptyString);
36}
37
38// https://tc39.github.io/ecma262/#sec-string.prototype.blink
39transitioning javascript builtin
40StringPrototypeBlink(
41    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
42  return CreateHTML(
43      receiver, 'String.prototype.blink', 'blink', kEmptyString, kEmptyString);
44}
45
46// https://tc39.github.io/ecma262/#sec-string.prototype.bold
47transitioning javascript builtin
48StringPrototypeBold(
49    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
50  return CreateHTML(
51      receiver, 'String.prototype.bold', 'b', kEmptyString, kEmptyString);
52}
53
54// https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor
55transitioning javascript builtin
56StringPrototypeFontcolor(
57    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
58  return CreateHTML(
59      receiver, 'String.prototype.fontcolor', 'font', 'color', arguments[0]);
60}
61
62// https://tc39.github.io/ecma262/#sec-string.prototype.fontsize
63transitioning javascript builtin
64StringPrototypeFontsize(
65    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
66  return CreateHTML(
67      receiver, 'String.prototype.fontsize', 'font', 'size', arguments[0]);
68}
69
70// https://tc39.github.io/ecma262/#sec-string.prototype.fixed
71transitioning javascript builtin
72StringPrototypeFixed(
73    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
74  return CreateHTML(
75      receiver, 'String.prototype.fixed', 'tt', kEmptyString, kEmptyString);
76}
77
78// https://tc39.github.io/ecma262/#sec-string.prototype.italics
79transitioning javascript builtin
80StringPrototypeItalics(
81    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
82  return CreateHTML(
83      receiver, 'String.prototype.italics', 'i', kEmptyString, kEmptyString);
84}
85
86// https://tc39.github.io/ecma262/#sec-string.prototype.link
87transitioning javascript builtin
88StringPrototypeLink(
89    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
90  return CreateHTML(
91      receiver, 'String.prototype.link', 'a', 'href', arguments[0]);
92}
93
94// https://tc39.github.io/ecma262/#sec-string.prototype.small
95transitioning javascript builtin
96StringPrototypeSmall(
97    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
98  return CreateHTML(
99      receiver, 'String.prototype.small', 'small', kEmptyString, kEmptyString);
100}
101
102// https://tc39.github.io/ecma262/#sec-string.prototype.strike
103transitioning javascript builtin
104StringPrototypeStrike(
105    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
106  return CreateHTML(
107      receiver, 'String.prototype.strike', 'strike', kEmptyString,
108      kEmptyString);
109}
110
111// https://tc39.github.io/ecma262/#sec-string.prototype.sub
112transitioning javascript builtin
113StringPrototypeSub(
114    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
115  return CreateHTML(
116      receiver, 'String.prototype.sub', 'sub', kEmptyString, kEmptyString);
117}
118
119// https://tc39.github.io/ecma262/#sec-string.prototype.sup
120transitioning javascript builtin
121StringPrototypeSup(
122    js-implicit context: NativeContext, receiver: JSAny)(...arguments): String {
123  return CreateHTML(
124      receiver, 'String.prototype.sup', 'sup', kEmptyString, kEmptyString);
125}
126}
127