Bug 160060 - Make parameters to Element.getElementsBy*() operations mandatory
Summary: Make parameters to Element.getElementsBy*() operations mandatory
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://dom.spec.whatwg.org/#interfac...
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-07-21 16:20 PDT by Chris Dumez
Modified: 2016-07-21 19:43 PDT (History)
11 users (show)

See Also:


Attachments
Patch (13.93 KB, patch)
2016-07-21 16:37 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (12.06 KB, patch)
2016-07-21 18:10 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-07-21 16:20:22 PDT
Make parameters to Element.getElementsBy*() operations mandatory to match the specification:
- https://dom.spec.whatwg.org/#interface-element

Firefox and Chrome agree with the specification so the compatibility risk should be low.

It makes very little sense to call these operations without parameter, especially considering WebKit uses the string "undefined" if the parameter is omitted.
Comment 1 Chris Dumez 2016-07-21 16:37:22 PDT
Created attachment 284281 [details]
Patch
Comment 2 Ryosuke Niwa 2016-07-21 17:08:38 PDT
Comment on attachment 284281 [details]
Patch

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

> Source/WebCore/dom/Element.idl:48
> -    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString name);
> +    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(DOMString name);

Why are changing Objective-C version?  I don't think we want to change the behavior of Objective-C API or do they behave identically in Objective-C?

> Source/WebCore/dom/Element.idl:72
> -    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName);
> +    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);

Ditto.

> Source/WebCore/dom/Element.idl:135
> -    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString name);
> +    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(DOMString name);

Ditto.
Comment 3 Chris Dumez 2016-07-21 18:06:55 PDT
(In reply to comment #2)
> Comment on attachment 284281 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=284281&action=review
> 
> > Source/WebCore/dom/Element.idl:48
> > -    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString name);
> > +    [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(DOMString name);
> 
> Why are changing Objective-C version?  I don't think we want to change the
> behavior of Objective-C API or do they behave identically in Objective-C?
> 
> > Source/WebCore/dom/Element.idl:72
> > -    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName);
> > +    [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
> 
> Ditto.
> 
> > Source/WebCore/dom/Element.idl:135
> > -    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString name);
> > +    [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(DOMString name);
> 
> Ditto.

"optional" has no impact on ObjC bindings. Therefore, I decided to harmonize the ObjC and the JS versions.
Comment 4 Chris Dumez 2016-07-21 18:10:10 PDT
Created attachment 284294 [details]
Patch
Comment 5 Chris Dumez 2016-07-21 19:43:30 PDT
Comment on attachment 284294 [details]
Patch

Clearing flags on attachment: 284294

Committed r203547: <http://trac.webkit.org/changeset/203547>
Comment 6 Chris Dumez 2016-07-21 19:43:36 PDT
All reviewed patches have been landed.  Closing bug.