Bug 137427 - Element.matches()'s argument is not supposed to be optional
Summary: Element.matches()'s argument is not supposed to be optional
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-04 20:24 PDT by Benjamin Poulain
Modified: 2014-10-05 17:41 PDT (History)
1 user (show)

See Also:


Attachments
Patch (7.68 KB, patch)
2014-10-04 20:26 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (14.41 KB, patch)
2014-10-05 16:45 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2014-10-04 20:24:24 PDT
Element.matches()'s argument is not supposed to be optional
Comment 1 Benjamin Poulain 2014-10-04 20:26:53 PDT
Created attachment 239288 [details]
Patch
Comment 2 Chris Dumez 2014-10-04 20:46:55 PDT
Comment on attachment 239288 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239288&action=review

r=me % nits.

> Source/WebCore/ChangeLog:8
> +        The argument was marked as optional, it is not supposed to:

nit: Maybe we should mention in the changeling that you are updating webkitMatchesSelector() as well?

> Source/WebCore/dom/Element.idl:125
> +    [ImplementedAs=matches, RaisesException] boolean webkitMatchesSelector(DOMString selectors);

No test coverage for this one? Maybe in the one for matches() ?

> LayoutTests/fast/dom/SelectorAPI/closest-definition.html:11
> +shouldBeUndefined('Element.matches');

You likely mean closest, not matches

> LayoutTests/fast/dom/SelectorAPI/matches-definition.html:2
> +<html>

We don't really need all these tags.
<!doctype html>
<script src="../../../resources/js-test-pre.js"></script>
<script>...</script>
<script src="../../../resources/js-test-post.js"></script>

> LayoutTests/fast/dom/SelectorAPI/matches-null-undefined.html:14
> +shouldThrow('document.getElementsByTagName("undefined")[0].matches()');

nit: How about specifying the exception as second parameter to shouldThrow? (same below and other tests). I personally like that we make sure we throw the right exception.
Comment 3 Benjamin Poulain 2014-10-05 16:37:51 PDT
(In reply to comment #2)
> We don't really need all these tags.
> <!doctype html>
> <script src="../../../resources/js-test-pre.js"></script>
> <script>...</script>
> <script src="../../../resources/js-test-post.js"></script>

I am updating the patch. I don't really understand this comment. What do you mean?
Comment 4 Chris Dumez 2014-10-05 16:42:54 PDT
Comment on attachment 239288 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=239288&action=review

>> LayoutTests/fast/dom/SelectorAPI/matches-definition.html:2
>> +<html>
> 
> We don't really need all these tags.
> <!doctype html>
> <script src="../../../resources/js-test-pre.js"></script>
> <script>...</script>
> <script src="../../../resources/js-test-post.js"></script>

I have been told by several reviewers before that we should omit the tags / sections if they're not needed, to keep the tests short. Here all <html>, <head> and <body> are not strictly needed. Technically, you just need the doctype and the scripts.
Comment 5 Benjamin Poulain 2014-10-05 16:45:09 PDT
Created attachment 239303 [details]
Patch
Comment 6 Benjamin Poulain 2014-10-05 16:48:06 PDT
(In reply to comment #4)
> (From update of attachment 239288 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=239288&action=review
> 
> >> LayoutTests/fast/dom/SelectorAPI/matches-definition.html:2
> >> +<html>
> > 
> > We don't really need all these tags.
> > <!doctype html>
> > <script src="../../../resources/js-test-pre.js"></script>
> > <script>...</script>
> > <script src="../../../resources/js-test-post.js"></script>
> 
> I have been told by several reviewers before that we should omit the tags / sections if they're not needed, to keep the tests short. Here all <html>, <head> and <body> are not strictly needed. Technically, you just need the doctype and the scripts.

I find this an odd advice. Our tests should use style that are the close to real use cases. Some variation is good but we should not force a minimalistic markup.

This does not apply to JS tests obviously.

Who complains about that?
Comment 7 Chris Dumez 2014-10-05 16:51:42 PDT
(In reply to comment #6)
> (In reply to comment #4)
> > (From update of attachment 239288 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=239288&action=review
> > 
> > >> LayoutTests/fast/dom/SelectorAPI/matches-definition.html:2
> > >> +<html>
> > > 
> > > We don't really need all these tags.
> > > <!doctype html>
> > > <script src="../../../resources/js-test-pre.js"></script>
> > > <script>...</script>
> > > <script src="../../../resources/js-test-post.js"></script>
> > 
> > I have been told by several reviewers before that we should omit the tags / sections if they're not needed, to keep the tests short. Here all <html>, <head> and <body> are not strictly needed. Technically, you just need the doctype and the scripts.
> 
> I find this an odd advice. Our tests should use style that are the close to real use cases. Some variation is good but we should not force a minimalistic markup.
> 
> This does not apply to JS tests obviously.
> 
> Who complains about that?

Well, I don't mind either way :) Your call.
I am sure I heard this advice from Blink reviewers. On WebKit side, it may have been rniwa@ but I am not 100% sure.
Comment 8 Benjamin Poulain 2014-10-05 17:41:17 PDT
Comment on attachment 239303 [details]
Patch

Clearing flags on attachment: 239303

Committed r174334: <http://trac.webkit.org/changeset/174334>
Comment 9 Benjamin Poulain 2014-10-05 17:41:24 PDT
All reviewed patches have been landed.  Closing bug.