Bug 160327 - Add support for Element.getAttributeNames()
Summary: Add support for Element.getAttributeNames()
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/#dom-elem...
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-07-28 16:26 PDT by Chris Dumez
Modified: 2016-07-28 19:52 PDT (History)
10 users (show)

See Also:


Attachments
Patch (13.69 KB, patch)
2016-07-28 16:43 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-28 16:26:55 PDT
Add support for Element.getAttributeNames():
- https://dom.spec.whatwg.org/#dom-element-getattributenames

Firefox already supports this, Chrome does not yet.
Comment 1 Chris Dumez 2016-07-28 16:43:12 PDT
Created attachment 284836 [details]
Patch
Comment 2 WebKit Commit Bot 2016-07-28 18:20:55 PDT
Comment on attachment 284836 [details]
Patch

Clearing flags on attachment: 284836

Committed r203852: <http://trac.webkit.org/changeset/203852>
Comment 3 WebKit Commit Bot 2016-07-28 18:21:00 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2016-07-28 19:18:45 PDT
Comment on attachment 284836 [details]
Patch

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

> Source/WebCore/dom/Element.cpp:505
> +    if (!hasAttributes())
> +        return attributesVector;

Is this an important optimization?
Comment 5 Chris Dumez 2016-07-28 19:52:05 PDT
Comment on attachment 284836 [details]
Patch

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

>> Source/WebCore/dom/Element.cpp:505
>> +        return attributesVector;
> 
> Is this an important optimization?

It has the benefit of checking that elementData is not null or the call to attributesIterator() below would crash.