-
Notifications
You must be signed in to change notification settings - Fork 311
Support isEqualNode
#1246
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
base: zigdom
Are you sure you want to change the base?
Support isEqualNode
#1246
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,10 @@ pub fn getOwnerElement(self: *const Attribute) ?*Element { | |
| return self._element; | ||
| } | ||
|
|
||
| pub fn isEqualNode(self: *const Attribute, other: *const Attribute) bool { | ||
| return std.mem.eql(u8, self.getName(), other.getName()) and std.mem.eql(u8, self.getValue(), other.getValue()); | ||
| } | ||
|
|
||
| pub const JsApi = struct { | ||
| pub const bridge = js.Bridge(Attribute); | ||
|
|
||
|
|
@@ -96,6 +100,8 @@ pub const JsApi = struct { | |
| pub const value = bridge.accessor(Attribute.getValue, null, .{}); | ||
| pub const namespaceURI = bridge.accessor(Attribute.getNamespaceURI, null, .{}); | ||
| pub const ownerElement = bridge.accessor(Attribute.getOwnerElement, null, .{}); | ||
|
|
||
| pub const isEqualNode = bridge.function(Attribute.isEqualNode, .{}); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need these. I guess it's probably a bit more efficient (though I don't really know how v8 resolves this)..but it isn't typically how we do it. The implementation on Node which dispatches into the type is good enough.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was after the little performance diff but you're right, using parent's method is more conventional. |
||
| }; | ||
|
|
||
| // This is what an Element references. It isn't exposed to JavaScript. In | ||
|
|
||
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.
Probably can't assume they're in order.