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

Make attributes lose their owner when removed #5507

Closed
wants to merge 1 commit into from

Conversation

@nox
Copy link
Member

nox commented Apr 3, 2015

@highfive
Copy link

highfive commented Apr 3, 2015

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon.

@hoppipolla-critic-bot
Copy link

hoppipolla-critic-bot commented Apr 3, 2015

Critic review: https://critic.hoppipolla.co.uk/r/4501

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

use dom::bindings::js::{OptionalRootedRootable, RootedReference};
use dom::bindings::js::{JSRef, MutNullableJS, Temporary};
use dom::bindings::js::{OptionalRootable, OptionalRootedRootable,
RootedReference};

This comment has been minimized.

@Manishearth

Manishearth Apr 3, 2015

Member

nit: For multiline imports, we usually just import twice, eg

use dom::bindings::js::{OptionalRootable, OptionalRootedRootable};
use dom::bindings::js::RootedReference;
fn set_owner(self, owner: Option<JSRef<Element>>) {
let ns = self.namespace.clone();
match (self.owner.get().root().r(), owner) {
(None, Some(new)) =>

This comment has been minimized.

@Manishearth

Manishearth Apr 3, 2015

Member

nit: braces on multiline match arms

match (self.owner.get().root().r(), owner) {
(None, Some(new)) =>
// Already in the list of attributes of new owner.
assert!(new.get_attribute(ns, &self.local_name).root().r() == Some(self)),

This comment has been minimized.

@Manishearth

Manishearth Apr 3, 2015

Member

perhaps use a debug_assert!?

This comment has been minimized.

@nox

nox Apr 3, 2015

Author Member

set_value() uses assert! for the same kind of invariant checking.

This comment has been minimized.

@Manishearth

Manishearth Apr 3, 2015

Member

okay, leave it then. We probably should move some asserts to debug asserts later, but for now I guess we can stick to asserts everywhere

@@ -244,6 +247,24 @@ impl<'a> AttrHelpers<'a> for JSRef<'a, Attr> {
&self.extended_deref().local_name
}

fn set_owner(self, owner: Option<JSRef<Element>>) {

This comment has been minimized.

@Manishearth

Manishearth Apr 3, 2015

Member

I suggest you leave a doc comment on this stating that it should be used after having moved the attr

@Manishearth
Copy link
Member

Manishearth commented Apr 3, 2015

Mostly looks good, save a few nits. r=me when they're fixed.

I assume there are no tests for this save for the one you upstreamed in wpt (which doesn't yet exist in our copy)

@nox nox force-pushed the nox:attributes-ownerElement branch from c886879 to 0849445 Apr 3, 2015
@nox
Copy link
Member Author

nox commented Apr 3, 2015

Nits fixed.

@nox nox force-pushed the nox:attributes-ownerElement branch from 0849445 to 525c2cd Apr 3, 2015
@jdm jdm added the S-awaiting-merge label Apr 3, 2015
@Manishearth
Copy link
Member

Manishearth commented Apr 4, 2015

Rolled up into #5519 because of CI brokenness

@nox nox force-pushed the nox:attributes-ownerElement branch from 525c2cd to 7b507c1 Apr 4, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Apr 4, 2015

Rebased as #5524

@Ms2ger Ms2ger closed this Apr 4, 2015
@nox nox deleted the nox:attributes-ownerElement branch Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.