Wiki

Clone wiki

wrapDetector / Home

Introduction

Current version: 1.0.1

wrapDetector is an easy-to-use plugin that detects characters where browsers can wrap text. A simple function call returns an array of such characters.

Building

If you want to build the files yourself, follow these instructions:

  1. Install Node.js.
  2. Install Grunt by opening a command line and typing: npm -g install grunt
  3. Download the wrapDetector source by either cloning this repository, or downloading a zip/tar file. See the Downloads tab above.
  4. Open a command line, point it to the root directory of the source (the folder containing grunt.js, and invoke grunt. On Windows, this means typing grunt.cmd. On other platforms, type grunt.
  5. The normal and minified versions will be written to the dist folder.

If any errors occur during the build process (for example, if lint throws a warning/error), please comment on my blog or open a new ticket.

License

This project is under an MIT license.

Simple usage

To get the list of characters, call:

var wraps = $.wrapDetector();

Advanced usage

By default, wrapDetector tests a variety of characters. The built-in list, without delimiters, follows: [space],~`!@#$%^&*()_-+={[}]\|;:'"<,>.?/

You can always override this list by passing a charsToTest option:

// Run the plugin with a limited number of characters to test
var wraps = $.wrapDetector({
    charsToTest: " ,!?"
});

Updated