Skip to content

Commit

Permalink
fix spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
niklak committed Jan 3, 2024
1 parent 68554a9 commit 4018818
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Changelog


## [0.3.1] - 2023-12-31
### Changed
- Minor refactoring.
### Fixed
- Fix spelling.
## [0.3.0] - 2023-12-31
### Changed
- Refactor dom_tree.rs -- remove internal macro, revise some functions for better performance.
- Improve perfomance for some functions inside, traversal.rs (switching from hashmaps to vecs).
- Add optional feature `hashbrown` -- which replace standart `HashSet` and `HashMap` with it's own implementation.
- Improve performance for some functions inside, traversal.rs (switching from hashmaps to vecs).
- Add optional feature `hashbrown` -- which replace standard `HashSet` and `HashMap` with it's own implementation.

## [0.2.1] - 2023-12-30
### Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dom_query"
version = "0.3.0"
version = "0.3.1"
description = "HTML manipulation with CSS seletors"
license = "MIT"
repository = "https://github.com/niklak/dom_query"
Expand Down
2 changes: 1 addition & 1 deletion examples/hacker_news.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
let html = include_str!("../test-pages/hacker_news.html");
let document = Document::from(html);

document.select("tr.athing:has(.title a)").iter().for_each(|athing| {
document.select("tr.athing:has(a[href][id])").iter().for_each(|athing| {
let title = athing.select(".title a");
let href = athing.select(".storylink");
println!("{}", title.text());
Expand Down
4 changes: 2 additions & 2 deletions src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl TreeSink for Document {
})
}

// Append a node as the last child of the given node. If this would produce adjacent slbling text nodes, it
// Append a node as the last child of the given node. If this would produce adjacent sibling text nodes, it
// should concatenate the text instead.
// The child node will not already have a parent.
fn append(&mut self, parent: &NodeId, child: NodeOrText<NodeId>) {
Expand Down Expand Up @@ -201,7 +201,7 @@ impl TreeSink for Document {

// Append a node as the sibling immediately before the given node.
// The tree builder promises that `sibling` is not a text node. However its old previous sibling, which would
// become the new node's previs sibling, could be a text node. If the new node is also a text node, the two
// become the new node's previous sibling, could be a text node. If the new node is also a text node, the two
// should be merged, as in the behavior of `append`.
fn append_before_sibling(&mut self, sibling: &NodeId, child: NodeOrText<NodeId>) {
match child {
Expand Down
3 changes: 2 additions & 1 deletion src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl<'a> selectors::Element for Node<'a> {
// Whether this element and the `other` element have the same local name and namespace.

fn is_same_type(&self, other: &Self) -> bool {
//TODO: maybe we should unpack compare_node directly here
self.tree
.compare_node(&self.id, &other.id, |a, b| {
if let (NodeData::Element(ref e1), NodeData::Element(ref e2)) = (&a.data, &b.data) {
Expand Down Expand Up @@ -143,7 +144,7 @@ impl<'a> selectors::Element for Node<'a> {
None => false,
},
Has(list) => {
//it checks only in self, not in inlines!
//it checks only in descendants
has_descendant_match(self, list, context)

//true
Expand Down
2 changes: 1 addition & 1 deletion src/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'a> Selection<'a> {
///
/// Panics if failed to parse the given CSS selector.
pub fn select(&self, sel: &str) -> Selection<'a> {
let matcher = Matcher::new(sel).expect("Invalid CSS seletor");
let matcher = Matcher::new(sel).expect("Invalid CSS selector");
Selection {
nodes: Matches::from_list(
self.nodes.clone().into_iter(),
Expand Down

0 comments on commit 4018818

Please sign in to comment.