Jump to content
Search Community

SplitText stopped handling orphans after update

Olgierd test
Moderator Tag

Recommended Posts

Hey,

 

I have recently updated GSAP in my project from version 3.11.5 to 3.12.5 and noticed one change in the SplitText Plugin which causes errors in handling proper text formatting by skipping non-breaking spaces.

 

After deminifying the file it appears that the newly added eb function inside the z function and its use of a couple of lines below in the conditions test is responsible for not honoring the  s in provided texts.

 

Of course, I can comment it out and replace it with the previous version of the condition test but I don't feel OK with making a mess in the library (and have to remember to "downdate" this chunk each time we update GSAP). And foremost I would like to learn if this change is the intended action or a missed error - although there is some difference in the orphans and widows definition between Polish and English, leaving the short word at the end of the line in Polish is considered an error and the correct way to move it to the next line it to "glue" it with the following word by non-breaking space.

 

I am not sure if I will be able to provide the minimal demo for different versions of SplitText/GSAP, but if it is necessary, I will at least try to mimic the input HTML & CSS with the baseline text flow.

Link to comment
Share on other sites

Hi,

 

Actually non breaking spaces should be honored and kept without any issues as far as I know.

 

It would be really interesting to see just the HTML and CSS (the simpler and smaller the better), as well as the GSAP and SplitText parts in order to understand what you're trying to achieve and what is not exactly working the way you intend.

 

Finally thanks for being a GSAP Club member and supporting GSAP! 💚

 

Happy Tweening!

Link to comment
Share on other sites

Hi Rodrigo,

 

thank you for the prompt reply.

 

Here is the demo replicated from the original project - maybe the code is not so minimal, but it keeps the exact layout of each word in reproduction:

 

See the Pen MWMoEOm by olaf-wilkosz (@olaf-wilkosz) on CodePen

 

In the copy above I have commented out the text-splitting part of the code and its animation itself (lines 35-49) - so you can see the correct line breaks with non-breaking spaces after short words (orphans).

 

Below there is a full working copy to see how the layout changes and short words remain at the end of the line:


See the Pen dyBzNzx by olaf-wilkosz (@olaf-wilkosz) on CodePen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...