-
Notifications
You must be signed in to change notification settings - Fork 227
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
Implement declarative shadow DOM #568
Implement declarative shadow DOM #568
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me, with one minor suggestion
afb0305
to
01cef16
Compare
01cef16
to
e22a6a0
Compare
// template start tag's shadowrootmode is not in the none state | ||
let is_shadow_root_mode = tag.attrs.iter().any(|attr| { | ||
attr.name.local == local_name!("shadowrootmode") | ||
&& (attr.value.to_string() == String::from("open") || attr.value.to_string() == String::from("close")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we compare attribute values without creating String
objects (which requires memory allocation)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, we can avoid String
creation in both sides like this:
attr.value.as_ref() == "open" || attr.value.as_ref() == "close"
I'll update with other missing parts of this feature.
Implement declarative shadow dom (DSD) since it is necessary for several minor issues on Servo (for example: servo/servo#34746, servo/servo#34745)
Design doc (WIP):
Declarative Shadow DOM for Servo
This PR implements DSD creation.