Conditional comments around CSS style blocks are gone
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.4k
- Forks
- 361
- Avg merge
- 3d 41m
- Merged PRs (30d)
- 2
Description
When using Filter.ExtractStyleBlocks to extract CSS style blocks, HTML conditional comments are removed, which leads to wrong looking HTML. I have this example code:
<head>
<style>
div {display: none;}
</style>
<!--[if IE 6]>
<style>
div {display: block;}
</style>
<![endif]-->
</head>
<body>
<div>hi</div>
</body>
</html>```
In this case, the link should only be shown in IE 6.
The output of HTML is the following, which is correct:
<div>hi</div>
The corresponding CSS style blocks look like this:
``` array(2) {
[0] =>
string(18) "div {
display:none
}"
[1] =>
string(19) "div {
display:block
}"
}
The information about the IE6 is gone, if I output both style blocks on the website, the div is always shown, because the conditional comment is gone.
At the moment I don't have a good idea how to fix this, I hope someone of you has an idea. The information is important and should not be lost.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Filter.ExtractStyleBlocks and reproduce the HTML example containing the IE6 conditional comment. Compare the extracted CSS blocks with the original markup and determine how the conditional-comment information is lost. Done means the extraction no longer produces output that incorrectly applies the conditional style unconditionally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100