Bug 111476 - Getting the descriptor selectionDirection throws error
Summary: Getting the descriptor selectionDirection throws error
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 49739
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-05 13:22 PST by Erik Arvidsson
Modified: 2016-04-12 03:30 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 2013-03-05 13:22:17 PST
var checkbox = document.createElement('input');
input.type = 'checkbox';
Object.getOwnPropertyDescriptor(input, 'selectionDirection');  // THROWS!

It is OK to throw when we try to get the value of the selectionDirection but is an ES5 spec violation to throw on getting the descriptor.

This is most likely because we report WebIDL attributes as data properties, and as such, we read the value of the property.
Comment 1 Simon Pieters (:zcorpan) 2016-04-06 03:33:55 PDT
Proposed spec change to not throw on getting: https://github.com/whatwg/html/pull/1006
Comment 2 Chris Dumez 2016-04-07 19:40:35 PDT
This is apparently fixed on WebKit trunk:
var input = document.createElement('input');
input.type = 'checkbox';
Object.getOwnPropertyDescriptor(input, 'selectionDirection');
-> returns undefined
Object.getOwnPropertyDescriptor(input.__proto__, 'selectionDirection');
-> returns {get: function, set: function, enumerable: true, configurable: true}

Feel free to reopen if I missed something.
Comment 3 Chris Dumez 2016-04-07 19:42:45 PDT
(In reply to comment #1)
> Proposed spec change to not throw on getting:
> https://github.com/whatwg/html/pull/1006

Oh, this does not seem strictly related to this bug. While WebKit no longer throws on getting the descriptor, accessing input.selectionDirection will throws.
Comment 4 Simon Pieters (:zcorpan) 2016-04-12 03:30:55 PDT
Right, filed https://bugs.webkit.org/show_bug.cgi?id=156500