Comments (4)
Hmm, an option to ignore stripping certain tags would be very welcome, I just ran into some hack today where <b>
tags are used to create rounded corners with some custom CSS on a <div>
, which apparently works even in older browsers. As things are, I'll have to hack these back with some custom scripting which is not ideal.
Something along the lines of a suppress-stripping-tags
parameter could be great where you can enumerate any tags from the current set of tags which get stripped without any control if no content is present. What are these by the way? <b>
, <i>
and <p>
for sure, but how about the rest?
from tidy-html5.
Hey Michael,
first of all thanks a lot for this fix!
I'm testing it right now, and seems that only the first level of empty elements are preserved when they are nested (I know...).
So this:
<div class="nifty-2"><b class="rtop-2"><b class="r2-2"></b><b class="r3-2"></b><b class="r4-2"></b></b>
<img src="img/icon/listicondark-back.gif" alt="Back" />
<span><a href="http://www.example.com" class="mobLink">Back</a></span>
<b class="rbottom-2"><b class="r4-2"></b><b class="r3-2"></b><b class="r2-2"></b><b class="r1-2"></b></b>
</div>
Becomes this (indentation edited for comparability):
<div class="nifty-2"><b class="rtop-2"></b>
<img src="img/icon/listicondark-back.gif" alt="Back">
<span><a href="http://www.example.com" class="mobLink">Back</a></span>
<b class="rbottom-2"></b>
</div>
Edit: adding
s doesn't seem to help either :( Am I right guessing that the parser just doesn't expect insanity like this and silently ignores these nested elements?
<div class="nifty-2"><b class="rtop-2"><b class="r2-2"> </b><b class="r3-2"> </b><b class="r4-2"> </b></b>
<img src="img/icon/listicondark-back.gif" alt="Back" />
<span><a href="http://www.example.com" class="mobLink">Back</a></span>
<b class="rbottom-2"><b class="r4-2"> </b><b class="r3-2"> </b><b class="r2-2"> </b><b class="r1-2"> </b></b>
</div>
<div class="nifty-2">
<b class="rtop-2"> </b>
<img src="img/icon/listicondark-back.gif" alt="Back">
<span><a href="http://www.example.com" class="mobLink">Back</a></span>
<b class="rbottom-2"> </b>
</div>
Edit2: just found out that this is actually an old method called "Nifty corners" for image-less rounded corners in older browsers: http://www.html.it/articoli/nifty/index.html
from tidy-html5.
This actually isn't caused by the empty-element-dropping part of the code. It's caused by another part of the code that merges nested markup. So if you do this:
<b class="rtop-2">foo<b class="r2-2">bar</b>baz<b class="r3-2">foo</b>bar<b class="r4-2">baz</b>foo</b>
You get this:
<b class="rtop-2">foobarbazfoobarbazfoo</b>
There is no option for preventing tidy from doing that, but I'll see if I can add one.
from tidy-html5.
Added two new options, "merge-emphasis" and "coerce-endtags":
http://w3c.github.com/tidy-html5/quickref.html#merge-emphasis
http://w3c.github.com/tidy-html5/quickref.html#coerce-endtags
Both are set to "yes" by default, to preserve the existing behavior.
To prevent Tidy from messing with most nested markup altogether, set both to "no".
from tidy-html5.
Related Issues (20)
- Rajab
- Error: <search> not recognized HOT 1
- `--clean` also merges nested lists (undocumented)
- tidy 5.8.0 reports version as 5.7.45 HOT 1
- Request.info
- Misleading warning for minlength attributes on input elements
- tidy-html5 Build failure on arm64-uwp
- "This document has errors" message gets "stuck" after hitting first error, when scanning multiple files
- nowrap and width attributes in <td> tag
- Stack-overflow on tidy-html5-5.8.0 HOT 2
- accessibility-check disables tidy-mark
- option "--indent-with-tabs yes" does NOT work as expected HOT 1
- can -i be performed without adding elements?
- Document --tidy-mark flag in tidy --help HOT 2
- Your website - Use HTML tidy perhaps? HOT 2
- embedded javascript is not being indented, nor is existing indentation preserved
- Display of options in help is not handling multibyte characters
- Always direct the user to the line where the crime occurred
- Warn about empty tags
- Say instead "`<` seen twice"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tidy-html5.