Why are there errant spans in my Confluence 4.3 pages?

Confluence appears to enjoy adding unnecessary spans within my text. It isn't uncommon for a paragraph to appear like this:

<span style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;">This </span> is an example of wh<span style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;">at I am </span>seeing. I<span style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;"> don't understand this</span>.

I can use the Source Editor to remove code and most of the time, my changes stick. However, sometimes the spans come back even if the paragraph in question wasn't edited.

When the page is published, you can't tell there is anything wonky going on. The trouble lies in exporting the page to a Word document using Scroll Office. Many times these spans will cause text to be dropped from the export, so the Word version ends up printing the paragraph like this:

This at I am don't understand this

I've noticed that cutting and pasting can cause the spans to occur, as can applying the monospace character style or even italics. In other words, the causes seem to be all over the place. I've been editing them out, but now I am at a loss for why they are coming back.

I am using Confluence 4.3.7.

2 answers

1 accepted

Hi Melissa and Mick,

It's actually not Confluence that likes adding these spans. It's webkit browsers such as Chrome and Safari. Confluence tries to take them away again. The versions of those browsers available when Confluence 4.3 was released indicate that they have added the style spans by adding a special marker class "Apple-style-span" to those spans. Confluence's editor looks for that class and removes the spans again.

Unfortuntely Chrome 26 and up do not add that class to the style span, so Confluence 4.3 is unable to find and repair them.

There is nothing you can do about it other than use Firefox, or Chrome 25, or upgrade to Confluence 5.2 or above.

The public issue about this bug is https://jira.atlassian.com/browse/CONF-29193, but it currently explains less than I have here.

The operations most likely to cause these are:

  • deleting paragraphs/headings, particularly when it causes a heading and a paragraph to be combined
  • copying and pasting, particularly copying from another rich-text source such as an html page

I hope this helps to explain what's going on and hopefully you can get your Confluence instance upgraded to a version with the fix.

Don,

thanks for the clarification. I can't remember see the apple-style tag, but I see lots of others. I can't give you a proper example at the moment, but formatting such as text size will appear in a <p> tag. The same or more bizarre things will happen with bullets.

But I agree about why they happen, ie deleting page elements and copying etc. I've long suspected that those were the things that actually cause it to happen.

Cheers.

Hi Mick,

I don't think I've explained clearly. I should start by explaining that the Confluence editor is built on top of browsers' built-in editing control, and that these are notoriously finnicky. Much of Confluence's job is to stop these built-in editors doing things that are undesirable. These spans are an example of that.

The browser adds style tags in order to make content you've pasted look just like it did in the copy. (for example). However, Confluence wants all the content to look relatively consistent, so it strips these styles back out again.

However, in Chrome 26 a change was made to the style spans and Confluence could no longer find and remove them.

The gory detail is:

Earlier Chrome versions used to add a helpful marker to these spans, so instead of adding a span like Melissa describes:

<span style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;">whatever</span>

It would include the class as a marker, like this:

<span class="apple-style-span" style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;">whatever</span>

And Confluence would dutifully see that class and strip the unwanted span out entirely.

In order to deal with that change in the browser, Confluence needs to be upgraded to version 5.2, where it uses other tactics for eradicating these spans.

Thank you Don. I appreciate your detailed explaination.

So it seems that the two ways to resolve this issue are to either upgrade Confluence to 5.2 or, if a Confuence upgrade isn't an option, downgrade Chrome/use Firefox.

Don,

No what you said was fine, thanks for the extra info though. :)

Cheers.

That's right Melissa. Or any Confluence after 5.2 of course, such as Confluence 5.4.4.

Don,

I'm now experiencing this using Confluence 5.9.9 and Chrome latest. This is definitely a copy and paste and cut and paste problem.

Even when I edit them out in the HTML, there's no guarantee they won't still come back (randomly). 

Also, this doesn't happen all the time and on every page. It is very random, but once a page goes rogue, you can guarantee they'll be back like a zombie apocalypse. smile

Cheers.

Melissa,

I can't help you with this, but I've asked the same question myself and received NO answer. Which is pretty poor as I've found that it can cause problems with content formatting. In fact, that's how I know that this extra code has been added.

I get exactly what you've shown, even in the latest 5.n.n download.

Obviously I'm not the only one with this problem, so hopefully someone from Atlassian will bother to answer the question or at least shed some light on it.

Cheers.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,298 views 25 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you