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.

I get this behavior, too, in Confluence Server 6.7.0 and latest Chrome on Windows 10.

Most commonly:

<span style="color: rgb(0,51,102);"> ... </span>

I typically don't notice that highlighting when viewing pages in the browser; it's more obvious in exported PDFs.

Also:

<span style="letter-spacing: 0.0px;"> ... </span>

In some cases, these span elements are nested, which can cause odd behavior in the editor, such as preventing you from inserting a link using that link text.

Don,

Since it's a current problem: is there an open CONFSERVER issue in Jira for this?

I couldn't find one. Should I create one?

I just tried to create a CONFSERVER "bug" Jira issue for this, but Jira said "No":

User 'grahan01' doesn't have the 'Assign Issues' permission

Clicking Create in Jira displays the usual dialog with an additional "Help us fix bugs faster" panel. That panel contains a "Report a new bug" button. Clicking that button leads to the "Confluence Server support resources", which leads me back to Jira.

Am I doing something wrong? Should I be able to create CONFSERVER "bugs" in Jira?

JaC no longer accepts simple bug reports, they have to be filtered through support (because there were so many that weren't bugs and needed to be support calls instead)

Go to https://support.atlassian.com/contact and follow the most appropriate route.

Thanks Nic. I've created a support request: CSP-228678, status ATLASSIAN INVESTIGATING.

If you're interested in the question "Why are there errant spans... ?", you might also be interested in a discussion item I recently created, "'User style' to show markup while editing pages".

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

993 views 23 13
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