Allow case insensitive closing tag names for script and style
This commit is contained in:
parent
abfc4bceaa
commit
d2bffe8005
|
@ -479,7 +479,7 @@ However, there are some syntax requirements for speed and sanity.
|
|||
|
||||
### Tags
|
||||
|
||||
Tags must not be [omitted](https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission). Void tags must not have a separate closing tag e.g. `</input>`.
|
||||
Opening tags must not be [omitted](https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission).
|
||||
|
||||
### Entities
|
||||
|
||||
|
@ -495,8 +495,6 @@ Numeric character references that do not reference a valid [Unicode Scalar Value
|
|||
|
||||
### Script and style
|
||||
|
||||
`script` and `style` tags must be closed with `</script` and `</style` respectively (case sensitive).
|
||||
|
||||
minify-html does **not** handle [escaped and double-escaped](./notes/Script%20data.md) script content.
|
||||
|
||||
## Issues and contributions
|
||||
|
|
|
@ -189,7 +189,7 @@ fn test_script_type_attr_value_removal() {
|
|||
eval(b"<script type=\"text/jscript\"></script>", b"<script></script>");
|
||||
eval(b"<script type=\"text/plain\"></script>", b"<script type=text/plain></script>");
|
||||
// Tag and attribute names should be case insensitive.
|
||||
eval(b"<SCRipt TYPE=\"application/ecmascript\"></script>", b"<script></script>");
|
||||
eval(b"<SCRipt TYPE=\"application/ecmascript\"></SCrIPT>", b"<script></script>");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -326,5 +326,5 @@ fn test_js_minification() {
|
|||
<script>let a = 1;</script>
|
||||
<script>let b = 2;</script>
|
||||
"#, b"<script>let a=1;</script><script>let b=2;</script>");
|
||||
eval_with_js_min(b"<script type=text/plain> alert(1.00000); </script>", b"<script type=text/plain> alert(1.00000); </script>");
|
||||
eval_with_js_min(b"<scRIPt type=text/plain> alert(1.00000); </scripT>", b"<script type=text/plain> alert(1.00000); </script>");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use aho_corasick::AhoCorasick;
|
||||
use aho_corasick::{AhoCorasick, AhoCorasickBuilder};
|
||||
use lazy_static::lazy_static;
|
||||
use crate::cfg::Cfg;
|
||||
use crate::err::ProcessingResult;
|
||||
|
@ -25,7 +25,7 @@ lazy_static! {
|
|||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref SCRIPT_END: AhoCorasick = AhoCorasick::new(&["</script"]);
|
||||
static ref SCRIPT_END: AhoCorasick = AhoCorasickBuilder::new().ascii_case_insensitive(true).build(&["</script"]);
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use aho_corasick::AhoCorasick;
|
||||
use aho_corasick::{AhoCorasick, AhoCorasickBuilder};
|
||||
use lazy_static::lazy_static;
|
||||
use crate::err::ProcessingResult;
|
||||
use crate::proc::MatchAction::*;
|
||||
|
@ -6,7 +6,7 @@ use crate::proc::MatchMode::*;
|
|||
use crate::proc::Processor;
|
||||
|
||||
lazy_static! {
|
||||
static ref STYLE_END: AhoCorasick = AhoCorasick::new(&["</style"]);
|
||||
static ref STYLE_END: AhoCorasick = AhoCorasickBuilder::new().ascii_case_insensitive(true).build(&["</style"]);
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
Loading…
Reference in New Issue