All notable changes to the dom_query
crate will be documented in this file.
- Exposed
Matcher::match_element
since it can be useful outside the crate. - Changed
impl<'a> selectors::Element for Node<'a>::opaque
to work with:has
pseudo-element fromselectors
crate. - Switched to
:has
implementation fromselectors
crate. - Internal changes due to switch to
selectors
v0.26.0 switch. Selection
methods that required&mut
now doesn't require&mut
, finally.- Improve performance for
Document::from
,Selection::select
and others. - Switched from using
rustc-hash
tofoldhash
.
- Added
Node::ancestors
method, that allows to get all or limited number of ancestors of a node. - Added
From<Vec<NodeRef<'a, NodeData>>> for Selection<'a>
- Enable support for
:is()
and:where()
pseudo-classes. - Added
Node::element_children
method that returns children nodes, that arenode_data::Element
s. - Added
Node::children_it
method that returns an iterator over children nodes. - Added
Node::ancestors_it
method that returns an iterator over ancestors nodes. - Added
Tree:child_ids_of
andTree:child_ids_of_it
methods that returns ids of the child nodes as vec and as iterator respectively. - Added
Tree:ancestor_ids_of
andTree:ancestor_ids_of_it
methods that returns ids of the ancestor nodes as vec and as iterator respectively. - Added
Node::immediate_text
method returns text of the node without it's descendants.Selection::immediate_text
does the same thing for the every node inside selection.
- Exposed
Document::tree
. Selection
methods that required&mut
now doesn't require&mut
.- Changed the project structure, now modules are divided based on the
struct
implementations.
- Added
Node::append_html
andNode::set_html
methods for creating children nodes of a single selected node. - Added
Tree<NodeData>::new_element
, an easy way to create an empty element with a given name. - Added
NodeRef::last_child
. - Added
Node::has_attr
method, which returnstrue
if an attribute exists on the node element.Selection::has_attr
does the same thing for the first node inside selection. - Added
Node::remove_all_attrs
method for removing all attributes of a node.Selection::remove_all_attrs
does the same thing for the every node inside selection. - Added
Node::remove_attrs
method, a convenient way to remove multiple attributes from the node element.Selection::remove_attrs
does the same thing for the every node inside selection. - Added
Node::rename
method, which allows to change node's name.Selection::rename
does the same thing for the every node inside selection.
- Added
select_single_matcher
andselect_single
methods forDocument
andSelection
. - Added
Document::fragment
which allows to create a document fragment.
- Update documentation
- A small breaking change:
From
implementation forDocument
, now it is based onInto<StrTendril>
and because of that, previousFrom<&String>
implementation will not work anymore (they are in config). If your code consumes&String
, you should useString::as_str()
instead. - Refactored the code (
NodeData::Element
).
- Removed a
readability
examples and related dev-dependencies.
- Added
Selection::inner_html
,Selection::try_html
, andSelection::try_inner
methods. - Added more examples and doc-tests.
- Improved the documentation.
- Fixed
Iterator::next
forMatches
- Added doc-tests
- Update dependencies.
- Refactor code due to major changes in html5ever 0.29.0
- Update dependencies.
- Update dependencies.
- Add support for
:has-text
and:contains
pseudo-classes, which allow to search elements by their text contents. Some example are here.
- Fix
:has
selector name comparison. Previously:has
behavior worked, even if pseudo-class just started from:has
.
- add
InnerNode<NodeData>.is_comment
.
- expose
dom_tree::NodeData
. - minor adjustments.
- revise
matcher::Matcher
usage, nowselection::Selection
's underlyingselect
methods usesmatcher::Matcher
reference if it possible. css::CssString
now wrapsString
instead ofStrTendril
. BecauseStrTendril
can't be shared between multiple threads without mutex.
- Minor refactoring.
- Fix spelling.
- Refactor dom_tree.rs -- remove internal macro, revise some functions for better performance.
- Improve performance for some functions inside, traversal.rs (switching from hashmaps to vecs).
- Add optional feature
hashbrown
-- which replace standardHashSet
andHashMap
with it's own implementation.
CssString
now wraps aStrTendril
instead of aString
.- Use
rustc_hash::FxHashSet
instead ofstd::collections::HashSet
. - Use
rustc_hash::FxHashMap
instead ofstd::collections::HashMap
.
- Replace unsafe code with safe code.