Hi

2008/12/17 David Fishburn <[email protected]>:

 > On Wed, Dec 17, 2008 at 10:40 AM, Ben Fritz <[email protected]> wrote:
 > > On Dec 17, 6:46 am, Ben Schmidt <[email protected]> wrote:
 > ...
 > > The other problem I saw with not using the fold column
 > > was the fact that URLs are automatically converted to
 > > links by the script. I envision that if we use the text
 > > itself as the link to toggle the fold, we'd just
 > > surround every line with an <a> tag.
 >
 > I would just use an onclick event on a SPAN tag (or
 > something) to open the fold rather than using <a>.
 >
 > > Since you can't nest <a> elements, we'd need to break
 > > the link used to toggle the fold, ending it just before
 > > the URL and beginning it again afterwards. Completely
 > > doable, but it adds additional complexity.
 >
 > That would get rid of this issue then, right?

Sounds good to me. You don't need to attach an onclick event
to each span either, you can delegate to a global handler:

<script>
    document.body.onclick = function(e){
        var target, fold;
        e = e || window.event;
        target = e.target || e.srcElement;
        if(!(target.nodeName === 'SPAN' && 'fold-col' === target.className)){
            return;
        }
        fold = target.parentNode.parentNode;
        fold.className = (fold.className === 'fold-closed') ?
            'fold-open' : 'fold-closed';
    };
</script>
</body>
</html>

The above works with the original html if you replace the
<a>s with <span>s. And, I know this is only a proof of
concept, but adding `cursor: pointer;' to .fold-col helps
too. By the way it looked fine in IE6. --Antony

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui