Blender3D/rainbow.linenumbers.js — pull request #2 by mzabriskie (2013-10-30 23:05:23+00:00)
Title: Fix for issues with Rainbow.color() called multiple times, and using Rainbow without nested <code> element

I found two issues with this plugin:

1. Rainbow automatically calls `Rainbow.color()` on load/domready. If it is explicitly called by the developer it errors since there is no longer a element found as it's been replaced by the

. This typically isn't a problem, but the element that Rainbow holds in memory no longer has a `parentNode` so when attempting to inject the

there is an `NPE` when referencing `block.parentNode`.
2. Rainbow does allow using a

directly without a nested . To accommodate for this a check is needed to see if `block` is a

. If so using `block.parentNode` is not necessary. In fact this would be dangerous as it would clear `innerHTML` of

or some other node.