es-string-html-methods
v1.0.3
Published
An ES-spec-compliant shim/polyfill/replacement for the Annex B String.prototype HTML methods that works as far down as ES3
Downloads
3,206
Maintainers
Readme
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
This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the spec.
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
String.prototype.big
String.prototype.blink
String.prototype.bold
String.prototype.fixed
String.prototype.fontcolor
String.prototype.fontsize
String.prototype.italics
String.prototype.link
String.prototype.small
String.prototype.strike
String.prototype.sub
String.prototype.sup
Getting started
npm install --save es-string-html-methods
Usage/Examples
var blink = require('es-string-html-methods/blink');
var link = require('es-string-html-methods/link');
var assert = require('assert');
assert.equal(
blink('a'),
'<blink>a</blink>'
);
assert.equal(
link('a', 'b'),
'<a href="b">a</a>'
);
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