Why are there errant spans in my Confluence 4.3 pages?
Asked by Melissa Henderson:

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.


Answers:
author: Don Willis
body: 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.)<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.

comments: author: Mick Davidson
body: 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.


author: Don Willis
body: 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.


author: Melissa Henderson
body: 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.


author: Mick Davidson
body: Don,

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

Cheers.


author: Don Willis
body: That's right Melissa. Or any Confluence after 5.2 of course, such as Confluence 5.4.4.


author: Mick Davidson
body: 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.


author: Graham Hannington
body: 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.


author: Graham Hannington
body: 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?


author: Graham Hannington
body: 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?


author: Nic Brough -Adaptavist-
body: 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.


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


author: Graham Hannington
body: 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](https://community.atlassian.com/t5/Confluence-discussions/quot-User-style-quot-to-show-markup-while-editing-pages/m-p/802778)".


author: Alice
body: Hi Graham,

I would like to vote for this issue - is it still open? When I try to view CSP-228678 I get the message "You can't view this issue - It may have been deleted or you don't have permission to view it."

Alice


author: Mick Davidson
body: 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.