_string-html.js 702 B

12345678910111213141516171819
  1. var $export = require('./_export');
  2. var fails = require('./_fails');
  3. var defined = require('./_defined');
  4. var quot = /"/g;
  5. // B.2.3.2.1 CreateHTML(string, tag, attribute, value)
  6. var createHTML = function (string, tag, attribute, value) {
  7. var S = String(defined(string));
  8. var p1 = '<' + tag;
  9. if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"';
  10. return p1 + '>' + S + '</' + tag + '>';
  11. };
  12. module.exports = function (NAME, exec) {
  13. var O = {};
  14. O[NAME] = exec(createHTML);
  15. $export($export.P + $export.F * fails(function () {
  16. var test = ''[NAME]('"');
  17. return test !== test.toLowerCase() || test.split('"').length > 3;
  18. }), 'String', O);
  19. };