ErrorFixer interface

Methods to modify the original source to fix errors.

replaceText method

Replaces the text at location.

Syntax

replaceText(location, replacement);

Return value

This method has no return value.

Parameters

Example

/* replace the text at given location with "lorem ipsum" */
fixer.replaceText(location, "lorem ipsum");

removeText method

Removes the text at location, optionally trimming whitespace before or after.

Syntax

removeText(location, [options]);

Return value

This method has no return value.

Parameters

Example

Given an element with the foo attribute:

<div foo="bar"></div>

To remove the attribute:

fixer.removeText(attr.location);

After removal the result would be:

<div ></div>

The whitespace before the attribute can be trimmed:

fixer.removeText(attr.location, { trimStart: true });

Resulting in <div> instead of <div >:

<div></div>