﻿<?xml version="1.0" encoding="utf-8" ?>
<bindings xmlns ="http://www.mozilla.org/xbl" xmlns:html ="http://www.w3.org/1999/xhtml">

  <binding id ="wordwrap" applyauthorstyles ="false">

    <implementation>
      <constructor>

        var elem = this;
        elem.addEventListener('overflow',
        function()
        {
        //alert('The text of this element will eventually be wrapped!');
        // matches any "mangled" HTML tag

        var exp = /< \/*[​='_\s\w]+>/g;
        //alert('else' + elem.innerHTML);
        var txt = elem.innerHTML;    // the bound element's innerHTML
        var chars = txt.split('');
        var newTxt = chars.join('​');
        newTxt = newTxt.replace(exp, reconstructTag);
        elem.innerHTML = newTxt ;

        },false);

        function reconstructTag(_tag)
        {
        return _tag.replace(/​/g,'');
        }
      </constructor>

    </implementation>

  </binding>

</bindings>
