Stripping SPANs and class attributes from html?
-
I’m trying to get some microformat data working in wordpress.com and it seems like class attributes get stripped from certain elements (at least CITE) and that SPAN tags get completely removed.
Is that possible or am I going mad? There’s no way that wp.com would make it completely impossible to use microformats on the site, right?
Eran.
-
Eran, unfortunately that’s exactly what happens. It’s caused me problems myself (to the point where I replaced text with an image, just to be able to style it – which isn’t exactly good practise).
This is done citing security concerns with executable Javascript – apparently it is possible to do bad things(tm). If you host a WordPress system yourself you’re not subject to that restriction, but apart from that you’re stuck & make do.
-
I can understand banning javascript but SPAN tags are not javascript. Neither are the CLASS attributes on my CITE tags (strangely, CLASS attrs are not stripped from DIV tags. Is there some malicious use of the CITE tag that I unaware of?)
-
I can see what you mean. Now that is strange (almost as strange as someone using the CITE tag..!)
Want to start a club? :)
-
For the record, you guys have got me on this one. I can’t find anything for CITE or CLASS in searches except for lists of allowed tags.
Sending in a feedback with a pointer.
-drmike
-
frankly, I’m also a little bit puzzled about the proper usage and the point of the
citeelement as well as theciteattribute, since (known to me) user-agent(s) don’t render reference sources visually or designate them somehow at all.this markup:
<cite>Joe</cite> said, <q cite="URI">bla!</q>wouldn’t have a distinct (for user) presentation (if it’s not decorated with a ‘style’, well ‘Joe’ would be italicized) and wont tell a user where exactly Joe said that.
my only uneducated guess it helps somehow data processing of the text marked up by this way, i.e. it’s mostly for machines rather than human being.
BTW, one can see that WP uses a
citeelement: in the ‘Incoming links’ on the Dashboard and in the post comments section. -
Sorry if the filters are a bit paranoid sometimes. I’ll go through them this weekend and see what valid attributes are needlessly blocked.
-
Andy, thanks for that. Feel free to contact me if you need any more info. You know how to get ahold of me.
-
CSS is a valid source for presentation info, imo. I still find it useful even if there is no default style associated with CITE tags. I think most WP templates render CITE in italics (as I think is common when using paper as well).
In this case, I am indeed trying to use more semantic markup so that I’m later able to parse out references from the post. But as I said, with a decent style sheet it is also useful for people reading in a browser.
Andy: Thanks for taking the time to look at this.
Eran.
-
At the moment the id attribute is deleted on saving which essentially disables hcal, which uses id.
-
- The topic ‘Stripping SPANs and class attributes from html?’ is closed to new replies.