Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(element): add one sweep element creation #109

Merged
merged 6 commits into from Feb 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/node.rs
Expand Up @@ -244,17 +244,11 @@ impl Element {

for a in attributes {
let name_local = a.name.local.deref();
let mut value = "";

if name_local == "id" {
j-mendez marked this conversation as resolved.
Show resolved Hide resolved
value = a.value.deref();
id = Some(LocalName::from(value));
}
if name_local == "class" {
if value.is_empty() {
value = a.value.deref();
}
classes.extend(value.split_whitespace().map(LocalName::from));
id = Some(LocalName::from(a.value.deref()));
} else if name_local == "class" {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was rushing and made this change without thinking. @adamreichold @cfvescovo feel free to squash the commits for this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, thanks

classes.extend(a.value.deref().split_whitespace().map(LocalName::from));
}

attrs.insert(a.name, a.value);
Expand Down