Why does Chrome spacing work in one JS file and not in the other?

advertisements

Update: Bug Resolved. Answer points go to whoever explains why the fix works.

If you highlight and copy the text in the first paragraph on this page, then paste it into a rich text editor (dreamweaver or gmail in rich text mode), you will see that some of the text is automagically linked. Basically, it works:

http://seox.org/link-building-pro.html --> http://seox.org/lbp/old-pretty.js

I'm trying to build a second version, but somewhere along the way I broke it. If you go along with the same process on this new url, spacing before and after the link are removed in Chrome:

http://seox.org/test.html --> http://seox.org/lbp/lb-core.js

Why does the spacing work correctly in the first one, but not in the second? More importantly, how do I fix the second one so that it doesn't bug out?

I asked a variation of this question before, and got a helpful and interesting answer, but hopefully I've asked the question with full detail this time around. The previous question, which has an answer I have a hard time understanding, is located here: Javascript: Whitespace Characters being Removed in Chrome (but not Firefox)

Thanks in advance for your time!


Edit: I've added a bounty to this post, and would greatly appreciate precise instructions on how to fix the bug (rather than general suggestions.

To better illustrate the bug, I've copied the gray box (from the second page) below. Note how the spacing is removed before and after the a tags:

Link Building 2 is an amazing tool that helps your website visitors share your content, with proper attribution. It connects to email, social sharing sites, eCommerce sites, and is the<a href="http://seox.org/test.html#seo">SEO</a>'s best friend. Think of it as the sneeze in the viral marketing metaphor.
<div>
  <p id="credit"><br />
    Read more about<a href="http://seox.org/test.html">Text Citations</a>by<a href="http://seox.org">seox.org</a></p>
</div>


Second Update:

I was able to solve the bug by adding the following to the top of the function processSel():

    lbp.vrs.holder.style.position = "absolute";

I'll award the correct answer to whoever can give the best explanation of why this fixes the spacing issue in chrome.


You have a typo on line 30.

... by <a href='http://" + lbp.page.domain + "' />" + lbp.defaults.author ...
                                                ^ (extra "/" before ">")