Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

XML/HTML Formatter empties style attributs #35

Open
neoscaler opened this issue Jan 28, 2015 · 8 comments
Open

XML/HTML Formatter empties style attributs #35

neoscaler opened this issue Jan 28, 2015 · 8 comments

Comments

@neoscaler
Copy link

The XML/HTML formatter empties style attributs. For example, if you have a tag like this in your HTML/XML file:

<th style="#{cc.attrs.hidden ? 'display:none' : ''}" >

Ater hitting CTRL+SHIFT+F the style attribute is empty:

<th style="" >

Disabling "Automatically close attribute values" did not help. Any ideas?

@hohwille
Copy link
Member

Interesting observation. From an XML perspective this a bug of the Eclipse formatter. But we have to figure out if this is actually a feature that wants to prevent using style attributes in HTML and that we need to switch off. So far I think it is a bug...

@hohwille
Copy link
Member

I created this test.html file and can confirm and reproduce the bug:

<html>
<head/>
<body>
<table>
<tr>
<th style="#{cc.attrs.hidden ? 'display:none' : ''}" >Bla</th>
</tr>
</table>
</body>
</html>

@hohwille
Copy link
Member

I can add any content to the style attribute and it gets removed on formatting while other attributes (e.g. class) remain as is. This seems to be more of a feature than a bug. I am still clueless where to switch it off.

@hohwille
Copy link
Member

If the file is named text.xml instead, the error does not occur. So it is a HTML feature of Eclipse...

@maybeec
Copy link
Member

maybeec commented Jan 31, 2015

I only found this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=358114
But unfortunately it does not describe in detail why this issue has not been resolved.

@maybeec
Copy link
Member

maybeec commented Jan 31, 2015

I had a look into eclipse source code regarding this.
What the formatter tries to do is to format the style contents using a CSSFormatter. If this does not work, the code tries to get any other Formatter which can handle the style value. Therefore, we do not really now which formatter breaks our style attributes.

It would be nice if there was some kind of a switch for disabling style formatting, but currently this seems to be not the case :(

@maybeec
Copy link
Member

maybeec commented Feb 2, 2015

This is also a very nice example where your style will be destroyed:
<body style="text-align: #{bundle['something']}">
becomes
<body style="text-align: #{bundle['something']">

@hohwille
Copy link
Member

This is really an Eclipse JDT bug and not related to oasp4j-ide:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=358114

There is pretty much nothing we can do about it except for waiting and hoping for Eclipse Mars release to fix it.

@hohwille hohwille added this to the backlog milestone Jun 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants