workaround for entity bug (?) in tabber

A user of my tabber script discovered that when his tab headings had an ampersand character like this:

<h2>Me &amp; My Shadow</h2>

Then the tab control displayed “&amp;” instead of a single ampersand character.

It looks like this occurs because the JavaScript DOM function document.createTextNode() does not convert entities. However, it looks like innerHTML does convert entities, so to fix your problem find the following line in tabber.js:

DOM_a.appendChild(document.createTextNode(t.headingText));

and replace with the following:

DOM_a.innerHTML = t.headingText;

I’ll think about this some more and if I can’t find any bad side effects I’ll add to the tabber code.

8 Responses to “workaround for entity bug (?) in tabber”

  1. FireWolf says:

    yeah thanx a lot man ;)

  2. wrxcrystal06 says:

    This almost fixes the issue. However, when you hover over the tab with the & the Title still shows & Can you please look into this?

    Thanks!

  3. knightrojen says:

    Thanks! I was just looking into this when I came across your answer! Great script!

  4. Lee says:

    Thanks for the codes you posted here…

    I found it very useful and successfully implemented in my own website.

    THANKS! very nice work!

    Cheers,
    Lee

  5. Tim says:

    Thanks, I also found a way to eliminate the hover. You just need to comment out this line:
    DOM_a.title = t.headingText;
    Which was give the text a title again.

  6. Jay Edgar says:

    Thanks–great tip! This is a really awesome tab system, and I appreciate your sharing it!

  7. Jenn says:

    This is a great feature! I was wondering if you knew of a way to make the tabs have 2 lines for the title? In other words, allow the tab titles to wrap within the tab? This way i can have longer names w/o the whole thing being stretched out far. Thanks!

  8. Angshuman says:

    how to disable a perticular tab….thank u

Leave a Reply