Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches:
- main

permissions:
contents: read

env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
Expand Down
30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lol_html"
version = "3.0.3"
version = "3.0.4"
authors = ["Ivan Nikulin <inikulin@cloudflare.com, ifaaan@gmail.com>"]
license = "BSD-3-Clause"
description = "Streaming HTML rewriter/parser with CSS selector-based API"
Expand All @@ -11,7 +11,7 @@ keywords = ["html", "css-selectors", "parser", "rewriter", "streaming"]
readme = "README.md"
include = ["/Cargo.toml", "/LICENSE", "/README.md", "/media", "/src"]
edition = "2024"
rust-version = "1.85"
rust-version = "1.95"

[lib]
# Disable libtest to make sure criterion can parse the command line flags.
Expand All @@ -29,31 +29,31 @@ harness = false
name = "bench"

[dependencies]
cssparser = "0.36"
bitflags = "2.11.1"
cfg-if = "1.0.4"
encoding_rs = "0.8.35"
hashbrown = "0.17.0"
cssparser = "0.38"
bitflags = "2.13.2"
cfg-if = "1.0.5"
encoding_rs = "0.8.42"
hashbrown = "0.17.1"
# hashbrown uses foldhash without std, which has a performance penalty
foldhash = { version = "0.2.0", features = ["std"] }
memchr = "2.8.0"
memchr = "2.8.3"
mime = "0.3.17"
selectors = "0.37"
selectors = "0.41"
thiserror = "2.0"
precomputed-hash = "0.1.1"

[dev-dependencies]
criterion = "0.8.2"
glob = "0.3.3"
hashbrown = { version = "0.17.0", features = ["serde"] }
glob = "0.3.4"
hashbrown = { version = "0.17.1", features = ["serde"] }
html5ever = "0.39"
markup5ever_rcdom = "0.39"
serde = "1.0.228"
serde_derive = "1.0.228"
serde_json = "1.0.149"
serde = "1.0.229"
serde_derive = "1.0.229"
serde_json = "1.0.154"
static_assertions = "1.1.0"
rand = "0.10"
itertools = "0.14"
itertools = "0.15"

[lints.rust]
keyword_idents = { level = "deny", priority = 1 }
Expand Down
48 changes: 18 additions & 30 deletions c-api/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 18 additions & 30 deletions js-api/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/parser/lexer/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,12 @@ impl<S: LexemeSink> StateMachineActions for Lexer<S> {

#[inline]
fn finish_attr(&mut self, _context: &mut ParserContext<S>, _input: &[u8]) -> ActionResult {
if let Some(attr) = self.current_attr.take() {
if let Some(StartTag { attributes, .. }) = self.current_tag_token.as_mut() {
attributes
.push(attr)
.map_err(RewritingError::MemoryLimitExceeded)?;
}
if let Some(attr) = self.current_attr.take()
&& let Some(StartTag { attributes, .. }) = self.current_tag_token.as_mut()
{
attributes
.push(attr)
.map_err(RewritingError::MemoryLimitExceeded)?;
}
Ok(())
}
Expand Down
16 changes: 8 additions & 8 deletions src/rewritable_units/text_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ impl IncompleteUtf8Resync {
if self.char_len > 0 {
let mut must_emit_now = false;
while let Some((&next_byte, rest)) = content.split_first() {
if is_continuation_byte(next_byte) {
if let Some(buf) = self.char_bytes.get_mut(self.char_len as usize) {
*buf = next_byte;
self.char_len += 1;
content = rest;
continue;
}
// overlong sequences fall here, and will be checked when the char_bytes is flushed
if is_continuation_byte(next_byte)
&& let Some(buf) = self.char_bytes.get_mut(self.char_len as usize)
{
*buf = next_byte;
self.char_len += 1;
content = rest;
continue;
}
// overlong sequences fall here, and will be checked when the char_bytes is flushed
must_emit_now = true;
break;
}
Expand Down
20 changes: 10 additions & 10 deletions src/rewriter/handlers_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,17 @@ impl<'h, H: HandlerTypes> ContentHandlersDispatcher<'h, H> {
self.element_handlers
.do_for_each_active_and_deactivate(|h| h(&mut element))?;

if self.next_element_can_have_content {
if let Some(elem_desc) = current_element_data {
if element.should_remove_content() {
elem_desc.remove_content = true;
self.matched_elements_with_removed_content += 1;
}
if self.next_element_can_have_content
&& let Some(elem_desc) = current_element_data
{
if element.should_remove_content() {
elem_desc.remove_content = true;
self.matched_elements_with_removed_content += 1;
}

debug_assert!(element.can_have_content());
if let Some(handler) = element.into_end_tag_handler() {
elem_desc.end_tag_handler_idx = self.end_tag_handlers.push(handler, false);
}
debug_assert!(element.can_have_content());
if let Some(handler) = element.into_end_tag_handler() {
elem_desc.end_tag_handler_idx = self.end_tag_handlers.push(handler, false);
}
}

Expand Down
Loading
Loading