I agree that style of the html code I sometimes get leaves much to be desired. In this case there is a <style> tag located inside <td> element. So chtml:parse injects the illegalstyle span in the code.
(serialize-to-string (chtml:parse " <table> <tr><td> <style type='text/css'> .someClass { width: 26px; height:26px; } </style> some data </td></tr></table> " (stp:make-builder)))
Will produce <html><head></head><body><table><tbody><tr><td> <span class="illegalstyle"> .someClass { width: 26px; height:26px; } </span> some data </td></tr></tbody></table> </body></html>
How do I disable this from being generated?
Thank you, Andrei
Hi,
Quoting Andrei Stebakov (lispercat@gmail.com):
I agree that style of the html code I sometimes get leaves much to be desired. In this case there is a <style> tag located inside <td> element. So chtml:parse injects the illegalstyle span in the code.
[...]
How do I disable this from being generated?
I'm afraid the answer is "change chtml".
The Closure HTML project is, at the moment, mainly a reusable form of Closure (the web browser)'s parser.
"Reusable" because it's a self-contained library, but indeed sometimes a little limited in its reusability because there are assumptions about how to repair non-DTD-conforming markup -- assumptions that either go too far or do the wrong thing entirely.
Personally I'd like to see two different modes:
1. repair HTML exactly like mainstream browsers do
(I think this is equivalent to implementing "HTML5" instead of trying to follow the HTML4 transitional DTD.)
2. ignore schema compliance issues entirely
(plain tag soup parsing)
In that respect I'd "take patches", but I'm currently not working on those patches myself.
d.
On Fri, Mar 4, 2011 at 4:11 PM, David Lichteblau david@lichteblau.com wrote:
Hi,
Quoting Andrei Stebakov (lispercat@gmail.com):
I agree that style of the html code I sometimes get leaves much to be desired. In this case there is a <style> tag located inside <td> element. So chtml:parse injects the illegalstyle span in the code.
[...]
How do I disable this from being generated?
I'm afraid the answer is "change chtml".
The Closure HTML project is, at the moment, mainly a reusable form of Closure (the web browser)'s parser.
"Reusable" because it's a self-contained library, but indeed sometimes a little limited in its reusability because there are assumptions about how to repair non-DTD-conforming markup -- assumptions that either go too far or do the wrong thing entirely.
Personally I'd like to see two different modes:
1. repair HTML exactly like mainstream browsers do
(I think this is equivalent to implementing "HTML5" instead of trying to follow the HTML4 transitional DTD.)
2. ignore schema compliance issues entirely
(plain tag soup parsing)
Is it easy to turn off the schema compliance? I am not quite familiar with the code so I wonder if it requires rewriting a lot of code?
In that respect I'd "take patches", but I'm currently not working on those patches myself.
d.