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

The span element containing a style tag causes markup corruption #1915

Closed
kandadaboggu opened this issue Aug 29, 2012 · 11 comments
Closed

The span element containing a style tag causes markup corruption #1915

kandadaboggu opened this issue Aug 29, 2012 · 11 comments

Comments

@kandadaboggu
Copy link
Contributor

When I save a page part with a span element containing the style tag the markup gets corrupted .

<span style="font-size:12px;">Hello World</span>

Gets saved as

Hello World</span>

I have seen this behavior in 2.0.6 and 2.0.8

@ugisozols
Copy link
Member

You're probably experiencing the same issue as in #1912, #1907 and #1891. It will be fixed in 2.0.9 so for now you can put this in your Gemfile:

gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git', :branch => '2-0-stable'

@kandadaboggu
Copy link
Contributor Author

I participated in #1891 thread. When I reverted to 2.0.6, I didn't see #1891.

The span issue exists in 2.0.6. I am suspecting the fix for #1891 might not address the span issue .

@ugisozols
Copy link
Member

Can you try the latest 2-0-stable branch and if it's still not working I'll reopen this issue. Thanks.

@kandadaboggu
Copy link
Contributor Author

I used 2-0-stable and I still see the same issue/bug. I used the following directive in my Gemfile.

gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git', :branch => '2-0-stable'

@ugisozols ugisozols reopened this Aug 30, 2012
@ugisozols
Copy link
Member

Can you try a span with a class instead of defining style directly?

In my case when I tried to save page with <span style="font-size:12px;">Hello World</span> after save span tags were gone but when I tried <span class="test">Hello World</span> it didn't remove anything.

Not sure how we should fix this.

@kandadaboggu
Copy link
Contributor Author

It works with class attribute. I see the problem only with the style
attribute. That too only in a span tag.

Is it possible that the HTML validation is stripping the style attribute?

@parndt
Copy link
Member

parndt commented Sep 5, 2012

It is possible. Can you check whether it's in the database after you save / whether it's being stripped out after it re-renders when you edit?

@kandadaboggu
Copy link
Contributor Author

The data stored in the database gets corrupted and the subsequent page rendering gets messed up. The effect is quite similar to #1891 and only difference is this issue existed as far back as 2.0.6.

@parndt
Copy link
Member

parndt commented Sep 5, 2012

Great so that rules out the sanitize method as being the culprit thanks for doing that.

This must be how wymeditor wants to work… can you add the same style attribute to any other kind of tag? Is it just span?

@kandadaboggu
Copy link
Contributor Author

Just the span tag. The style attribute worked with div, p, table tags. It is possible that there are other errant tags that I haven't encountered.

@parndt
Copy link
Member

parndt commented Sep 5, 2012

Maybe it's the fact that span is an inline tag vs a block tag such as div, p, table etc. At any rate it gives us something to investigate!

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

Successfully merging a pull request may close this issue.

3 participants