From 69c852a9562cb5af52ad1f376b6ae96f0bf77511 Mon Sep 17 00:00:00 2001 From: Will Bamberg Date: Wed, 22 Jun 2022 11:31:26 -0700 Subject: [PATCH] Remove replaceAll polyfill --- kumascript/macros/CSSSyntax.ejs | 12 ++++++------ package.json | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/kumascript/macros/CSSSyntax.ejs b/kumascript/macros/CSSSyntax.ejs index 40d9cdba19dc..7eeaf65e21b8 100644 --- a/kumascript/macros/CSSSyntax.ejs +++ b/kumascript/macros/CSSSyntax.ejs @@ -10,7 +10,6 @@ const webRefData = require('@webref/css'); const { definitionSyntax } = require('css-tree'); -const replaceAll = require('string.prototype.replaceall'); const locale = env.locale; @@ -125,8 +124,8 @@ function renderNode(name, node) { } case 'Type': { // encode < and > - let encoded = replaceAll(name, '<', '<'); - encoded = replaceAll(encoded, '>', '>'); + let encoded = name.replaceAll('<', '<'); + encoded = encoded.replaceAll('>', '>'); // add CSS class: we use "property" because there isn't one for types const span = `${encoded}`; // if this type is not included in the syntax, link to its dedicated page @@ -134,8 +133,9 @@ function renderNode(name, node) { return span; } else { // the slug does not include the angle brackets - let slug = replaceAll(name, '<', ''); - slug = replaceAll(slug, '>', ''); + let slug = name.replaceAll('<', ''); + slug = slug.replaceAll('>', ''); + // also remove the range in square brackets, as in "" slug = slug.replace(/\[.*\]/, '') return `${span}`; } @@ -171,7 +171,7 @@ function renderNode(name, node) { if (node.combinator && (node.combinator !== ' ')) { const info = syntaxDescriptions[node.combinator]; // note that we are replacing the combinator surrounded by spaces, like " | " - name = replaceAll(name, ` ${node.combinator} `, ` ${node.combinator} `); + name = name.replaceAll(` ${node.combinator} `, ` ${node.combinator} `); } return name; diff --git a/package.json b/package.json index a952e64eec7c..f94dc3f8e9d4 100644 --- a/package.json +++ b/package.json @@ -224,7 +224,6 @@ "semver": "^7.3.5", "source-map-explorer": "^2.5.2", "source-map-loader": "^3.0.0", - "string.prototype.replaceall": "^1.0.6", "style-dictionary": "^3.7.1", "style-loader": "^3.3.1", "stylelint": "^13.13.1",