Skip to content

Commit

Permalink
Merge pull request #20 from zignis/patch-1
Browse files Browse the repository at this point in the history
fix: `destory` -> `destroy` typo
  • Loading branch information
fefit authored Sep 11, 2023
2 parents e6c683a + a84b3cc commit 2d97ed0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "visdom"
version = "0.5.10"
version = "1.0.0"
edition = "2018"
description = "A html document syntax and operation library, use APIs similar to jquery, easy to use for web scraping and confused html."
keywords = ["html", "scrape", "jquery", "query", "selector"]
Expand All @@ -27,15 +27,15 @@ default = []
full = [
"text",
"insertion",
"destory"
"destroy"
]
text = []
insertion = []
destory = []
destroy = []

[package.metadata.docs.rs]
all-features = true

[[bench]]
name = "benchmark"
harness = false
harness = false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ After version v0.5.0, visdom add some feature flags to support conditional compi

| Feature | Description | API | Config |
| :---------- | :---------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------- |
| `destory` | When you don't need remove or clear the elements, you can ignore this feature flag. | `.remove()` `.empty()` (IElementTrait) `remove_child()` | `visdom = { version = xxx, features = ["destory"]}` |
| `destroy` | When you don't need remove or clear the elements, you can ignore this feature flag. | `.remove()` `.empty()` (IElementTrait) `remove_child()` | `visdom = { version = xxx, features = ["destory"]}` |
| `insertion` | When you don't need mutation the DOM, you can ignore this feature flag. | `append()` `append_to()` `prepend()` `prepend_to()` `insert_after()` `after()` `insert_before()` `before()` `replace_with()` | `visdom = { version = xxx, features = ["insertion"]}` |
| `text` | When you don't need mutation the TextNode, you can ignore this feature flag. | `.texts()` `.texts_by()` `texts_by_rec()` | `visdom = { version = xxx, features = ["text"]}` |
| `full` | When you need all the API above, you can open this feature flag. | - | `visdom = { version = xxx, features = ["full"]}` |
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ impl IElementTrait for Rc<RefCell<Node>> {
.collect::<String>()
}

// when the feature `destory` or `insertion` is open
// when the feature `destroy` or `insertion` is open
cfg_feat_mutation! {
/// impl `remov_child`
fn remove_child(&mut self, ele: BoxDynElement) {
Expand Down Expand Up @@ -1066,8 +1066,8 @@ impl Document {
let root = Rc::clone(&self.doc.borrow().root);
Elements::with_all(vec![Box::new(root)], Some(Box::new(self)))
}
/// Destory the document
pub fn destory(self) {}
/// Destroy the document
pub fn destroy(self) {}
}

impl IDocumentTrait for Document {
Expand Down Expand Up @@ -1154,7 +1154,7 @@ impl IDocumentTrait for Document {
/// texts.for_each(|_index, text_node|{
/// let orig_text = text_node.text();
/// let replace_html = format!("<span>{}</span><b>!</b>", orig_text);
/// // Be careful that now the text_node is destoryed by `set_html`
/// // Be careful that now the text_node is destroyed by `set_html`
/// text_node.set_html(&replace_html);
/// true
/// });
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ macro_rules! cfg_feat_insertion {
macro_rules! cfg_feat_mutation {
($($item:item)*) => {
$(
#[cfg(any(feature = "destory", feature = "insertion"))]
#[cfg(any(feature = "destroy", feature = "insertion"))]
$item
)*
};
Expand Down
2 changes: 1 addition & 1 deletion tests/mutation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg(any(feature = "destory", feature = "insertion"))]
#![cfg(any(feature = "destroy", feature = "insertion"))]
use std::assert_eq;
use std::result::Result as StdResult;
use visdom::types::BoxDynError;
Expand Down

0 comments on commit 2d97ed0

Please sign in to comment.