'a'
mh-two-thousand-and-two
2024-04-12 44d2c92345cd156a59fc327b3060292a282d2893
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
'use strict';
 
var $TypeError = require('es-errors/type');
 
var callBound = require('call-bind/callBound');
 
var $replace = callBound('String.prototype.replace');
 
var RequireObjectCoercible = require('./RequireObjectCoercible');
var ToString = require('./ToString');
 
// https://262.ecma-international.org/6.0/#sec-createhtml
 
module.exports = function CreateHTML(string, tag, attribute, value) {
    if (typeof tag !== 'string' || typeof attribute !== 'string') {
        throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings');
    }
    var str = RequireObjectCoercible(string);
    var S = ToString(str);
    var p1 = '<' + tag;
    if (attribute !== '') {
        var V = ToString(value);
        var escapedV = $replace(V, /\x22/g, '&quot;');
        p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22';
    }
    return p1 + '>' + S + '</' + tag + '>';
};