hassankhan/emojify.js — pull request #7 by dylanjha (2013-03-24 08:57:23+00:00)
Title: Enhancement and Bug Fix 

### Enhancement:

* pass a DOM id to `setConfig({ })`; This allows the user to specify that they only want emojify to search one node and its children. This improver performance because there is no point in crawling all of `document.body` when the user knows that emojis are only going to show up in one place. Usage:

```javascript

emojify.setConfig({
emojify_tag_type: 'div',
only_crawl_id: 'messages-container',
emoticons_enabled: true,
people_enabled: true,
nature_enabled: true,
objects_enabled: true,
places_enabled: true,
symbols_enabled: true
});
```

### Bug

* In this scenario, emojify was broken.
1. execute `emojify.run()`
2. Load more "emojiable" content on the page dynamically
3. execute `emojify.run()` again. No exceptions are thrown, but the new content does not get "emojified"

*The problem*
Each array gets emptied out by the `shift()` method on line [974](https://github.com/hassankhan/emojify.js/blob/master/emojify.js#L974). That means, when you go back and execute the `emojify.run()` method again, all the arrays are empty, so the function doesn't find any matches.

*The solution*
This [commit](https://github.com/dylanjha/emojify.js/commit/49820029afa27ee9dd1ae2afdef1a8efe41bf7f1) duplicates each array into a local variable `_*` that is then mutated by `shift()`. The original array remains intact to it can be duplicated again the next time the `run()` method is executed.

:beers: Cheers! Thanks for building this tool, it's really handy.