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

Implement and test DOMTokenList.replace (fixes #8511) #9353

Merged
merged 2 commits into from Mar 25, 2016

Conversation

@nox
Copy link
Member

nox commented Jan 17, 2016

Thanks to @sankha93 for the original work in #8525.

Review on Reviewable

@nox
Copy link
Member Author

nox commented Jan 17, 2016

This is a WIP: replace actually needs supports to be implemented.

@frewsxcv
Copy link
Member

frewsxcv commented Jan 18, 2016

I know it's a WIP, but a couple suggestions if you weren't already going to do them:

  1. explicitly add in the spec steps
  2. create a separate internal function run_update_steps that performs the steps outlined here and link to that
@nox
Copy link
Member Author

nox commented Jan 18, 2016

There is no run_update_steps because the associated attribute's value is actually the only storage for their list of tokens. We already do this.

@asajeffrey asajeffrey self-assigned this Feb 4, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Feb 12, 2016

The latest upstream changes (presumably #9605) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm
Copy link
Member

jdm commented Feb 24, 2016

@nox What's the status here? Is this still classified a WIP and needs more work, or should @asajeffrey be reviewing it?

@nox
Copy link
Member Author

nox commented Feb 24, 2016

I'll look at it tonight or tomorrow while rebasing it.

@asajeffrey
Copy link
Member

asajeffrey commented Feb 24, 2016

I've been holding off while it has conflicts, let me know when you're ready.

@nox nox force-pushed the nox:domtokenlist-replace branch from b1f5276 to 636c0fc Feb 25, 2016
@nox nox removed the S-needs-rebase label Feb 25, 2016
@nox
Copy link
Member Author

nox commented Feb 25, 2016

@asajeffrey This is ok to go.

@asajeffrey
Copy link
Member

asajeffrey commented Feb 25, 2016

Mostly this looks fine, there's a spec issue plus a couple of extra tests I think we should add, but otherwise cool


Reviewed 4 of 4 files at r1.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


components/script/dom/domtokenlist.rs, line 135 [r1] (raw file):
It looks like this is slightly different from the spec in the case list.replace("a b", ""). The spec says it should throw a SyntaxError, it will actually throw an InvalidCharacterError.


tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html, line 84 [r1] (raw file):
Can we add tests:

assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('', 'a b'); }
assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('a b', ''); }

tests/wpt/web-platform-tests/dom/nodes/Element-classlist.html, line 263 [r1] (raw file):
Can we add a test for the case where we're replacing a token with one that's already in the list:

  secondelem.className = 'token1 token2 token3'
  secondelem.classList.replace('token1', 'token3');
  assert_equals( secondelem.classList.length, 2 );
  assert_false( secondelem.classList.contains('token1') );
  assert_true( secondelem.classList.contains('token2') );
  assert_true( secondelem.classList.contains('token23') );

Comments from the review on Reviewable.io

@jdm
Copy link
Member

jdm commented Feb 25, 2016

I think assert_throws(new SyntaxError(), function () { elem.classList.replace('', 'a b'); } is more idiomatic.

@Ms2ger
Copy link
Contributor

Ms2ger commented Feb 25, 2016

That's an other kind of SyntaxError

@bors-servo
Copy link
Contributor

bors-servo commented Mar 1, 2016

The latest upstream changes (presumably #9763) made this pull request unmergeable. Please resolve the merge conflicts.

@asajeffrey
Copy link
Member

asajeffrey commented Mar 10, 2016

@nox: is this PR still open?

@nox
Copy link
Member Author

nox commented Mar 10, 2016

It is still open, still blocked, still didn't address it, I'll try to do it soon.

@nox nox force-pushed the nox:domtokenlist-replace branch from 636c0fc to d848645 Mar 22, 2016
@nox
Copy link
Member Author

nox commented Mar 22, 2016

@asajeffrey Ready to go.

@asajeffrey
Copy link
Member

asajeffrey commented Mar 22, 2016

Okay, I'll take a look later today.

@asajeffrey
Copy link
Member

asajeffrey commented Mar 23, 2016

Reviewed 4 of 4 files at r2.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


components/script/dom/domtokenlist.rs, line 142 [r2] (raw file):
Can you add comments for how the code lines up with the steps of the spec?


Comments from the review on Reviewable.io

@nox nox force-pushed the nox:domtokenlist-replace branch from d848645 to d010df9 Mar 24, 2016
@asajeffrey
Copy link
Member

asajeffrey commented Mar 25, 2016

Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

@asajeffrey
Copy link
Member

asajeffrey commented Mar 25, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Mar 25, 2016

📌 Commit d010df9 has been approved by asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Mar 25, 2016

Testing commit d010df9 with merge 59ba00e...

bors-servo added a commit that referenced this pull request Mar 25, 2016
Implement and test DOMTokenList.replace (fixes #8511)

Thanks to @sankha93 for the original work in #8525.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9353)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 25, 2016

💔 Test failed - linux-rel

@asajeffrey
Copy link
Member

asajeffrey commented Mar 25, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Mar 25, 2016

Previous build results for android, arm32, gonk, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor are reusable. Rebuilding only linux-rel...

@bors-servo
Copy link
Contributor

bors-servo commented Mar 25, 2016

@bors-servo bors-servo merged commit d010df9 into servo:master Mar 25, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
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

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