https://github.com/es-shims/es-string-html-methods
An ES-spec-compliant shim/polyfill/replacement for the Annex B String.prototype HTML methods that works as far down as ES3
https://github.com/es-shims/es-string-html-methods
anchor big blink bold ecmascript fixed fontcolor fontsize html italics javascript link polyfill shim small strike string sub sup
Last synced: 3 months ago
JSON representation
An ES-spec-compliant shim/polyfill/replacement for the Annex B String.prototype HTML methods that works as far down as ES3
- Host: GitHub
- URL: https://github.com/es-shims/es-string-html-methods
- Owner: es-shims
- License: mit
- Created: 2021-09-01T21:29:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-14T15:27:44.000Z (10 months ago)
- Last Synced: 2025-09-11T11:36:30.436Z (4 months ago)
- Topics: anchor, big, blink, bold, ecmascript, fixed, fontcolor, fontsize, html, italics, javascript, link, polyfill, shim, small, strike, string, sub, sup
- Language: JavaScript
- Homepage:
- Size: 90.8 KB
- Stars: 1
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# es-string-html-methods [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
An ES-spec-compliant shim/polyfill/replacement for the Annex B String.prototype HTML methods that works as far down as ES3
This package implements the [es-shim API](https://github.com/es-shims/api) “multi” interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-additional-properties-of-the-string.prototype-object).
Because the `String.prototype` HTML methods depend on a receiver (the `this` value), the main export in each subdirectory takes the string to operate on as the first argument.
The main export of the package itself is simply an array of the available directory names. It’s sole intended use is for build tooling and testing.
## Supported methods
- [`String.prototype.anchor`](https://tc39.es/ecma262/#sec-string.prototype.anchor)
- [`String.prototype.big`](https://tc39.es/ecma262/#sec-string.prototype.big)
- [`String.prototype.blink`](https://tc39.es/ecma262/#sec-string.prototype.blink)
- [`String.prototype.bold`](https://tc39.es/ecma262/#sec-string.prototype.bold)
- [`String.prototype.fixed`](https://tc39.es/ecma262/#sec-string.prototype.fixed)
- [`String.prototype.fontcolor`](https://tc39.es/ecma262/#sec-string.prototype.fontcolor)
- [`String.prototype.fontsize`](https://tc39.es/ecma262/#sec-string.prototype.fontsize)
- [`String.prototype.italics`](https://tc39.es/ecma262/#sec-string.prototype.italics)
- [`String.prototype.link`](https://tc39.es/ecma262/#sec-string.prototype.link)
- [`String.prototype.small`](https://tc39.es/ecma262/#sec-string.prototype.small)
- [`String.prototype.strike`](https://tc39.es/ecma262/#sec-string.prototype.strike)
- [`String.prototype.sub`](https://tc39.es/ecma262/#sec-string.prototype.sub)
- [`String.prototype.sup`](https://tc39.es/ecma262/#sec-string.prototype.sup)
## Getting started
```sh
npm install --save es-string-html-methods
```
## Usage/Examples
```js
var blink = require('es-string-html-methods/blink');
var link = require('es-string-html-methods/link');
var assert = require('assert');
assert.equal(
blink('a'),
'a'
);
assert.equal(
link('a', 'b'),
'a'
);
```
```js
require('./auto'); // shim all of the methods
require('./anchor/auto'); // shim the “anchor” method
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/es-string-html-methods
[npm-version-svg]: https://versionbadg.es/es-shims/es-string-html-methods.svg
[deps-svg]: https://david-dm.org/es-shims/es-string-html-methods.svg
[deps-url]: https://david-dm.org/es-shims/es-string-html-methods
[dev-deps-svg]: https://david-dm.org/es-shims/es-string-html-methods/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/es-string-html-methods#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/es-string-html-methods.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/es-string-html-methods.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/es-string-html-methods.svg
[downloads-url]: https://npm-stat.com/charts.html?package=es-string-html-methods
[codecov-image]: https://codecov.io/gh/es-shims/es-string-html-methods/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/es-string-html-methods/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/es-string-html-methods
[actions-url]: https://github.com/es-shims/es-string-html-methods/actions