Skip to content

Commit c74a7ad

Browse files
authored
Don't return a string from TreeSink::attach_declarative_shadow_root (#633)
* Don't return a string from TreeSink::attach_declarative_shadow_root Signed-off-by: Simon Wülker <[email protected]> * Bump html5ever to 0.34 Signed-off-by: Simon Wülker <[email protected]> --------- Signed-off-by: Simon Wülker <[email protected]>
1 parent 6c0f148 commit c74a7ad

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Add html5ever as a dependency in your [`Cargo.toml`](https://crates.io/) file:
2020

2121
```toml
2222
[dependencies]
23-
html5ever = "0.32"
23+
html5ever = "0.34"
2424
```
2525

2626
You should also take a look at [`examples/html2html.rs`], [`examples/print-rcdom.rs`], and the [API documentation][].

html5ever/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "html5ever"
3-
version = "0.33.0"
3+
version = "0.34.0"
44
authors = [ "The html5ever Project Developers" ]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/servo/html5ever"

html5ever/src/tree_builder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,9 +1492,9 @@ where
14921492
tag: &Tag,
14931493
shadow_host: &Handle,
14941494
template: &Handle,
1495-
) -> Result<(), String> {
1495+
) -> bool {
14961496
self.sink
1497-
.attach_declarative_shadow(shadow_host, template, tag.attrs.clone())
1497+
.attach_declarative_shadow(shadow_host, template, &tag.attrs)
14981498
}
14991499

15001500
fn create_formatting_element_for(&self, tag: Tag) -> Handle {

html5ever/src/tree_builder/rules.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ where
173173

174174
// Step 3 - 8.
175175
// Attach a shadow root with declarative shadow host element, mode, clonable, serializable, delegatesFocus, and "named".
176-
if self.attach_declarative_shadow(&tag, &shadow_host, &template).is_err() {
176+
let succeeded = self.attach_declarative_shadow(&tag, &shadow_host, &template);
177+
if !succeeded {
177178
// Step 8.1.1. Insert an element at the adjusted insertion location with template.
178179
// Pop the current template element created in step 2 first.
179180
self.pop();

markup5ever/interface/tree_builder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ pub trait TreeSink {
249249
true
250250
}
251251

252-
/// Attach declarative shadow
252+
/// Attempt to attach a declarative shadow root at the given location.
253+
///
254+
/// Returns a boolean indicating whether the operation succeeded or not.
253255
fn attach_declarative_shadow(
254256
&self,
255257
_location: &Self::Handle,
256258
_template: &Self::Handle,
257-
_attrs: Vec<Attribute>,
258-
) -> Result<(), String> {
259-
Err(String::from(
260-
"No implementation for attach_declarative_shadow",
261-
))
259+
_attrs: &[Attribute],
260+
) -> bool {
261+
false
262262
}
263263
}
264264

rcdom/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ path = "lib.rs"
1616

1717
[dependencies]
1818
tendril = "0.4"
19-
html5ever = { version = "0.33", path = "../html5ever" }
19+
html5ever = { version = "0.34", path = "../html5ever" }
2020
markup5ever = { version = "0.16", path = "../markup5ever" }
2121
xml5ever = { version = "0.23", path = "../xml5ever" }
2222

0 commit comments

Comments
 (0)