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
Contributor

@nox nox commented Jan 17, 2016

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

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 17, 2016
@nox
Copy link
Contributor Author

nox commented Jan 17, 2016

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

@frewsxcv
Copy link
Contributor

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
Contributor 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

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Feb 12, 2016
@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
Contributor Author

nox commented Feb 24, 2016

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

@asajeffrey
Copy link
Member

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

@nox nox removed the S-needs-rebase There are merge conflict errors. label Feb 25, 2016
@nox
Copy link
Contributor Author

nox commented Feb 25, 2016

@asajeffrey This is ok to go.

@asajeffrey
Copy link
Member

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

@asajeffrey asajeffrey added S-awaiting-answer Someone asked a question that requires an answer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 25, 2016
@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

@Ms2ger Ms2ger added the S-needs-code-changes Changes have not yet been made that were requested by a reviewer. label Feb 26, 2016
@bors-servo
Copy link
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 1, 2016
@asajeffrey
Copy link
Member

@nox: is this PR still open?

@nox
Copy link
Contributor Author

nox commented Mar 10, 2016

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

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Mar 22, 2016
@nox nox removed S-awaiting-answer Someone asked a question that requires an answer. S-needs-rebase There are merge conflict errors. labels Mar 22, 2016
@nox
Copy link
Contributor Author

nox commented Mar 22, 2016

@asajeffrey Ready to go.

@asajeffrey
Copy link
Member

Okay, I'll take a look later today.

@asajeffrey
Copy link
Member

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
Copy link
Contributor Author

nox commented Mar 24, 2016

@asajeffrey
Copy link
Member

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

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit d010df9 has been approved by asajeffrey

@highfive highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Mar 25, 2016
@bors-servo
Copy link
Contributor

⌛ Testing commit d010df9 with merge 59ba00e...

@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 25, 2016
bors-servo pushed 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

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 25, 2016
@asajeffrey
Copy link
Member

@bors-servo
Copy link
Contributor

⚡ 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

☀️ Test successful - android, arm32, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor

@bors-servo bors-servo merged commit d010df9 into servo:master Mar 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-tests-failed The changes caused existing tests to fail.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants