Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: content of adjacent textNodes is not merged before word-splitting #26

Closed
maranomynet opened this issue May 20, 2009 · 6 comments
Closed
Labels

Comments

@maranomynet
Copy link

Consider this code:

var elm = document.createElement('div');
document.body.appendChild(elm);

elm.appendChild(document.createTextNode('wo'));
elm.appendChild(document.createTextNode('rd'));
alert(elm.innerHTML); // Alerts: "word"

Cufon.replace(elm);
setTimeout(function(){
    alert(elm.getElementsByTagName('canvas').length);  // Alerts: 2
  }, 500);

Cufon considers elm to contain two seperate words - "wo" and "rd" - creating seperate <canvas> elements for each...

@maranomynet
Copy link
Author

First version of the code example was slightly disfunctional - added setTimeout to make it run properly...

@sorccu
Copy link
Owner

sorccu commented May 21, 2009

The easiest solution would be to use Node.normalize(), it's supposed to be supported in IE6 but I'll have to to run some tests.

https://developer.mozilla.org/En/DOM/Node.normalize
http://msdn.microsoft.com/en-us/library/ms536646(VS.85).aspx

@sorccu
Copy link
Owner

sorccu commented Jun 7, 2009

As expected, normalize() is indeed somewhat broken in IE 6, 7 and 8:

http://cufon.shoqolate.com/tests/normalize/

@maranomynet
Copy link
Author

Hi. Has there been any progress on fixing this bug?

@sorccu
Copy link
Owner

sorccu commented Jul 21, 2009

Fixed in commit 2bd440d.

@maranomynet
Copy link
Author

Awesome! :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants