Wiki
Clone wikiwrapDetector / 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:
- Install Node.js.
- Install Grunt by opening a command line and typing:
npm -g install grunt
- Download the wrapDetector source by either cloning this repository, or downloading a zip/tar file. See the Downloads tab above.
- 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 typinggrunt.cmd
. On other platforms, typegrunt
. - 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